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

Steps for accessing the files uploaded in a React application

Looking to implement an upload button using material UI that allows users to upload multiple files, with the goal of saving their paths into an array for future use. However, I'm unsure about where these uploaded files are stored. The code snippet be ...

Sliding through HTML content

Unfortunately, I lack expertise in advanced HTML and CSS. After some investigation, I attempted to create a "content slider" similar to the one on the Redlight Traffic website (an anti-human trafficking organization). However, my efforts have been unsucces ...

Unable to output value in console using eventListener

Hey everyone, I'm new to JavaScript and trying to deepen my understanding of it. Currently, I am working on an 8 ball project where I want to display the prediction in the console. However, I keep getting an 'undefined' message. const predi ...

Using Wordpress? Customize your sidebar with three widgets and don't forget to add the "last" class to the third one for a polished look

Successfully set up a custom sidebar on my WordPress website and configured it to display three widgets. The CSS for the sidebar includes a specific styling for each widget, with an additional class to remove margin-right from the last (third) widget. reg ...

Encountering 404 Error in Production with NextJS Dynamic Routes

I'm currently working on a next.js project that includes a dynamic routes page. Rather than fetching projects, I simply import data from a local JSON file. While this setup works well during development, I encounter a 404 error for non-existent pages ...

The update of the attribute in jQuery on a checkbox is not causing the change event to trigger

I am working on a feature where there are multiple checkboxes along with a status box that indicates if at least one of the checkboxes is checked. Additionally, I have included a Check All/None checkbox that can toggle all the checkboxes. However, althoug ...

Navigating events within the Material Design Light (MDL) mdl-menu component can be

I am utilizing Material Design Light with just PHP, jQuery, and MDL min CSS and JS, no other frameworks involved. Keeping it simple with a basic menu. <button id="lang-switcher" class="mdl-button mdl-js-button mdl-button--fab mdl-js-ripple-effect"> ...

Tips for displaying multiple XML datasets on an HTML webpage

I came across an example on W3schools that I'm trying to replicate: http://www.w3schools.com/xml/tryit.asp?filename=tryxml_app_first However, the example only displays one CD. My goal is to showcase all the data (in this case CDs) in the XML file. H ...

Tips for Showing jGrowl Messages When Redirecting Pages

After setting up jgrowl, everything appears to be functioning properly. Currently, I have to manually press a button in order for the message to appear in the top right side of the screen as shown below: <input type="button" onclick="$.jGrowl('You ...

Learn how to dynamically chain where conditions in Firebase without prior knowledge of how many conditions will be added

Currently, I am working on a project using Angular and firebase. My goal is to develop a function that can take two arguments - a string and an object, then return an Observable containing filtered data based on the key-value pairs in the object for a spe ...

Can Regex expressions be utilized within the nodeJS aws sdk?

Running this AWS CLI command allows me to retrieve the correct images created within the past 45 days. aws ec2 describe-images --region us-east-1 --owners self -- query'Images[CreationDate<`2021-12-18`] | sort_by(@, &CreationDate)[].Name&apos ...

Node.js not receiving expected Ajax response

Why is my Ajax request not receiving the proper response? It always shows readyState '4' with a response status of '0'. What could be causing this issue? Client-Side Code: var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = f ...

Encountering an issue in Laravel when trying to retrieve data using relationships and the paginate() method

When I try to fetch data using paginate(10), Vue.js does not work. However, if I use paginate(5), it works fine. The code in the Controller with relationships in the model files is working fine and returns a 200 OK response. $results = Posts::with([' ...

Building a single-page app optimized for mobile viewing with Foundation framework

Currently facing an issue with the scaling of the viewport on certain mobile devices when loading new content via ng-include in our responsive website built on Foundation. The problem arises as the width of the page breaks, leading to horizontal scrolling. ...

Accessing files from various directories within my project

I'm working on a project with 2 sources and I need to import a file from MyProject into nest-project-payment. Can you please guide me on how to do this? Here is the current file structure of my project: https://i.stack.imgur.com/KGKnp.png I attempt ...

Condense items into objects and arrays when the Express query yields multiple objects in a many-to-many query

I have a situation where my SQL queries are returning multiple objects due to a many-to-many mapping in express. I am in search of a tool that can help me simplify these common objects by nesting arrays of objects within them. SELECT * FROM User LEFT JOIN ...

What are the necessary steps for incorporating Payment/Bank transactions into an e-commerce platform?

Right now, I'm utilizing HTML, CSS, jQuery, and some JavaScript to develop a website. As I work on creating the store section, I find myself unsure of how to incorporate payment methods and all related features. Are there any free "pre-built" systems ...

JavaScript's addition of CSS animation not functioning as intended

I am facing an issue with a web page utilizing Bootstrap 5. The webpage consists of one element stacked on top of another. My goal is to fade-out the top element after a certain period. Here is what I have tried: HTML <div id="host" class=&qu ...

I'm facing an issue with SSRProvider in my NextJs application

My application is developed using NextJs and Typescript, utilizing the react-bootstrap library for creating components. I am facing an issue where I keep receiving an error message stating that When server rendering, you must wrap your application in an &l ...