Javascript 如何在jQueryMobile中清除外部页面的文本字段值

Javascript 如何在jQueryMobile中清除外部页面的文本字段值,javascript,html,jquery-mobile,Javascript,Html,Jquery Mobile,我有两个页面index.html和external.html。在index.html中,我有两个文本字段。在这些文本字段中插入一些文本并单击按钮,我将进入external.html页面。这个external.html页面有一个链接到index.html的按钮。单击该按钮时,它会将我移动到index.html 现在的问题是,当我从external.html移到index.html时,文本字段保留了它以前的值。我希望它在进入index.html页面时清除以前的值。怎么做,请帮帮我 index.htm

我有两个页面index.html和external.html。在index.html中,我有两个文本字段。在这些文本字段中插入一些文本并单击按钮,我将进入external.html页面。这个external.html页面有一个链接到index.html的按钮。单击该按钮时,它会将我移动到index.html

现在的问题是,当我从external.html移到index.html时,文本字段保留了它以前的值。我希望它在进入index.html页面时清除以前的值。怎么做,请帮帮我

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>


你在找这样的东西吗

$(document).on('pageshow', function () {
    $('.clearme').val("");
});

这就是我所期待的。非常感谢。
function gotopage( gotopage )
{ 
  $.mobile.changePage($( gotopage ), { transition: "slide"});
}



function _gotopage( page )
{
  $.mobile.changePage( page);
}
$(document).on('pageshow', function () {
    $('.clearme').val("");
});