I have two pages index.html and external.html.In index.html i have two text field. Inserting some text in those text field and clicking on a button i goes to external.html page.This external.html page has one button linking to index.html. When in click in that button it moves me to index.html.
Now the problem is when i move from external.html to index.html, the text fields remainds its previous value. i wanted it to clear its previous value when coming to index.html page. How to do that, please help me.
index.html
<section id="firstpage" data-role="page">
<header data-role="header" data-position="fixed">
<h1>First</h1>
</header>
<div data-role="content" >
<script type="text/javascript" >
$( function(){
$( '#name_field' ).val( "" );
});
$(document).ready(function () {
$('.clearme').focus(function() {
$(this).val("");
});
});
</script>
<label for="name" >Name:</label>
<input type="text" name="name" id="name_field" value="" class="clearme" placeholder="Enter Name"/>
<label for="email">Email:</label>
<input type="email" name="email" id="email_field" value="" placeholder="Enter Email Id" />
<input type="submit" id="button" value="External Page" data-theme="b" onclick="_gotopage( 'http://localhost/test/external.html' );"/>
</div>
<footer data-role="footer" data-theme="d" >
</footer>
</section>
external.html
<section id="secondpage" data-role="page">
<header data-role="header" data-position="fixed">
<h1>External</h1>
</header>
<div data-role="content" >
<script type="text/javascript" >
</script>
<input type="submit" id="comment_enter_button" value="Index Page" data-theme="b" onclick="_gotopage( 'http://localhost/test/index.html' );"/>
</div>
<footer data-role="footer" data-theme="d" >
</footer>
</section>
script.js
function gotopage( gotopage )
{
$.mobile.changePage($( gotopage ), { transition: "slide"});
}
function _gotopage( page )
{
$.mobile.changePage( page);
}
Is something like this what you’re looking for?: