admin管理员组文章数量:1426072
I have 2 pages(i.e., page_1 and page_2) in the container page(i.e., page.html).In the first page i have only one button if you click on that then it will navigates to the second page.when you e back from the second page to First page and once again click on the button for navigating to the second page at this time i want to reload/refresh the page. i tried but i am not getting please can anybody help me.
Here the code:
<div data-role="page" id="page_1" >
<div data-role="content" id="contentlogin">
<a href="#" onclick="refresh();" data-role="button" id="login">Navigation</a>
</div>
</div>
<div data-role="page" id="page_2" >
<div data-role="content" id="contentlogin">
//Some Form elements are there
</div>
</div>
<script type="text/javascript">
function refresh()
{
$.mobile.changePage($("#page_2"), {transition: "pop",reloadPage: true});
}
</script>
thanks
I have 2 pages(i.e., page_1 and page_2) in the container page(i.e., page.html).In the first page i have only one button if you click on that then it will navigates to the second page.when you e back from the second page to First page and once again click on the button for navigating to the second page at this time i want to reload/refresh the page. i tried but i am not getting please can anybody help me.
Here the code:
<div data-role="page" id="page_1" >
<div data-role="content" id="contentlogin">
<a href="#" onclick="refresh();" data-role="button" id="login">Navigation</a>
</div>
</div>
<div data-role="page" id="page_2" >
<div data-role="content" id="contentlogin">
//Some Form elements are there
</div>
</div>
<script type="text/javascript">
function refresh()
{
$.mobile.changePage($("#page_2"), {transition: "pop",reloadPage: true});
}
</script>
thanks
Share Improve this question edited Jan 5, 2012 at 11:40 naresh asked Jan 5, 2012 at 9:03 nareshnaresh 10.4k25 gold badges83 silver badges125 bronze badges1 Answer
Reset to default 3You could try something like this:
- http://jsfiddle/sJdfy/4/
JS
$('#page_3').live('pageshow',function(event, ui) {
// refresh specific element
$('#refresh').val('');
});
$('#page_2').live('pageshow',function(event, ui) {
// refresh all elements
var allInputs = $(':input');
allInputs.val('');
});
HTML
<div data-role="page" id="page_1" >
<div data-role="content" name="contentlogin">
<a href="#page_2" data-role="button" id="login">Navigate to page 2</a>
<a href="#page_3" data-role="button">Navigate to page 3</a>
Yeah Page 1
</div>
</div>
<div data-role="page" id="page_2" >
<div data-role="content" name="contentlogin">
<a href="#page_1" data-role="button">Navigate to page 1</a>
<!-- Some Form elements are there -->
Hello we are on Page 2<br />Refresh All Elements<br /><br />
<label for="basic1">Text Input 1 (Refresh):</label>
<input type="text" name="name1" id="basic1" value="" />
<label for="refresh1">Text Input 2 (Refresh):</label>
<input type="text" name="name21" id="refresh1" value="" />
<br /> Enter in some values, Navigate to Page 1 and back to Page 2
</div>
</div>
<div data-role="page" id="page_3" >
<div data-role="content" name="contentlogin">
<a href="#page_1" data-role="button">Navigate to page 1</a>
<!-- Some Form elements are there -->
Hello we are on Page 3<br />Refresh Specific Elements<br /><br />
<label for="basic">Text Input 1:</label>
<input type="text" name="name" id="basic" value="" />
<label for="refresh">Text Input 2 (Refresh):</label>
<input type="text" name="name2" id="refresh" value="" />
<br /> Enter in some values, Navigate to Page 1 and back to Page 3
</div>
</div>
本文标签: javascriptJqueryMobile How to reloadrefresh the internal pageStack Overflow
版权声明:本文标题:javascript - Jquery-Mobile: How to reloadrefresh the internal page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745447938a2658749.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论