There appears to be some lingering content in the JQuery Mobile slide-out dialog box

My jQuery mobile slide out dialog box is experiencing an issue. The first time the slide out occurs, a comment box appears where users can enter comments and then submit them, followed by a "THANK YOU" message.

However, when the user closes the dialog box and slides it out again for the second time, the "THANK YOU" message remains instead of generating a fresh comment box.

Even if a user enters text in the comment box without submitting it and goes back, the next slide out dialog box still displays the previously entered text!

I would greatly appreciate any assistance with this problem.

Below is the HTML code:

  <!DOCTYPE html>
  <html>
  <head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css">
  <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
  <script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
  </head>
  <body>
    <div data-role="page" id="pageone">

     <div data-role="header">
       <h1>Welcome To My Homepage</h1>
     </div>

     <div data-role="main" class="ui-content">
       <p>Click on the link to see the slide effect.</p>
       <a href="#pagetwo" data-transition="slide">Slide to Dialog Page</a>
     </div>

     <div data-role="footer">
       <h1>Footer Text</h1>
     </div>

   </div>

   <div data-role="page" data-dialog="true" id="pagetwo">

     <div data-role="header">
       <h1>Thank You!</h1>
     </div>

     <div data-role="main" class="ui-content">
       <form action="thankyou.asp" autocomplete="on">
         Comment:<input type="text" name="comment"><br>
         <input type="submit" value="Submit">
       </form>
       <a href="#pageone">Go Back</a>
     </div>

   </div>
</body>
</html>

Answer №1

To refresh the form on the same page, you will need to reset it manually with:

$("#form")[0].reset();

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Unexpected fragments returned by Woocommerce during woocommerce_add_to_cart_fragments hook

I'm currently working on a unique customization for my WooCommerce cart where I am trying to update the quantity of a cart item dynamically. Although the updating functionality works correctly, I'm facing an issue where the cart doesn't refr ...

React Component that closes when it loses focus

In my React project, I am working on creating a custom select2 style component. Most of the functionality is complete, but I am struggling with figuring out how to hide the result box when the user clicks away. Here is the render method: render() { l ...

Troubleshooting why passing $var within @{{ }} in Vue.js + Laravel is not functioning as expected

I am integrating Algolia Vue-InstantSearch into a Laravel Project. Since we are working with a blade file, the {{ }} symbols will be recognized by the php template engine. To ensure that they are only understood by Vue in JavaScript, we can add an @ prefix ...

Is it permissible to enclose useEffect hooks within an IIFE?

Currently, I am dealing with a project that is rife with anti-patterns. One issue that has caught my attention is the use of Immediately Invoked Function Expressions (IIFE) around multiple useEffect hooks. Here is a snippet of the code in question: conditi ...

Ways to customize the border color on a Card component using React Material UI

Is there a way to change the border color of a Card component in React Material UI? I attempted using the style property with borderColor: "red" but it did not work. Any suggestions on how to achieve this? ...

Executing a PHP script

As I work on setting up a html form integrated with php for submitting user data to a database, I'm curious about the best tools to utilize in order to run and successfully test my program. Since it is a php file, what are the most efficient methods t ...

PHP persistent forms dropdowns and checkbox selection

I am currently working on a PHP form and I am facing an issue with the drop-down boxes and checkboxes. I want them to stay filled even if I don't select something, maintaining the previously entered details while leaving the unfilled parts empty. I ha ...

Tips for incorporating transition animations into route changes in next.js

On the homepage, there are 2 links that I want to have distinct transition animations for. For example, if I click the link on the left, the animation should start from the left and move towards the right when changing routes. ...

Tips for managing input for objects in Vue when the object hasn't been declared yet?

<input type="text" v-model="object[obj]"> Output: object:{'obj1':value} Desired outcome after input is added: object:{'obj1':{'prop1':value,'prop2':value}} <input type="text" ...

Creating a full-screen background with an rgba overlay using CSS

I recently encountered an issue with a fixed, fullscreen background image on my website. I initially applied the background image to the HTML's CSS instead of the body's CSS. To add a black overlay with lowered opacity, I included the following c ...

Tips for retrieving the value of a textarea in the jQuery LineControl Editor

I recently integrated a jquery plugin into my project to develop a wysiwyg text editor. I set up a textarea element to contain the text editor: <textarea class="editor" rows="3" name="textEditor" id="textEditor&quo ...

Being required to design a distinct div for every article I am extracting from the API

In the midst of developing a website for my college project, I have successfully configured my news API to pull and display data using JavaScript. Currently, I am faced with the challenge of having to create separate div elements each time I want to add n ...

What is the best way to ensure consistent spacing between columns in a Bootstrap 3 grid layout, similar to the spacing on the left and right sides?

Is there a way to achieve equal spacing between all blocks in a row, similar to the left and right padding that Bootstrap automatically applies? Currently, Bootstrap adds padding to all columns on both sides, but does not render extra spacing on the left s ...

Public directory assets not accessible

After working extensively with Node and Angular, I realized my back-end structure needed some serious attention. In an effort to streamline my process, I decided to separate the client and server components and create a reusable skeleton for future applica ...

Display the progress bar's completion percentage during animation

Creating a progress bar using HTML with the following structure: <div class="progressbar"><div class="text">%0 Completed</div> <div class="progressbar_inner"></div> </div> Implemented jQuery code fo ...

How can data be displayed in AngularJS/Json without using ng-repeat?

It seems like I am required to use ng-repeat in order to display the data, but I would prefer to avoid using it. angular: App.controller('aboutLongCtrl', function ($scope, $http) { $http.get('test_data/ar_org.json') .then(func ...

I am in need of eliminating repetitive comments from each post

data structure can you help figure out what is causing the issue in this code that seems to be removing old comments? mutations:{ getPosts(state) { let unique = [...new Set(state.posts)]; for (let i = 0; i < uniq ...

CodeIgniter does not support the foreach function

I am encountering an issue with the foreach function where the resulting data is not displaying all information from the database. The table in question is named "view_kebutuhan_perjal". Code snippet from Model: function getPerjal() { $query= ...

Is there a way to display an alert using JavaScript that only appears once per day?

I've created a website that displays an alert to the user upon logging in. Currently, the alert is shown each time the user logs in, but I'm looking to make it display only once per day at initial page loading. How can I achieve this? Below i ...

Is there a way to extract only the value from the most recent request?

While working with VueJS, I have a handler for changes in an input field that looks like this: inputHandler(url, params){ const p = new Promise((resolve, reject) => { const xhr = new XMLHttpRequest(); xhr.open('POST&ap ...