According to the jQuery Mobile configuration behavior , it will automatically process links and submit forms via Ajax whenever possible. Therefore, when you open a new page (subpage), a new page will be added to the DOM main page. During this time, you will lose JavaScript written on a new page.
According to my thinking, you can disable the Ajax form and link.
To do this, write the link as follows:
<a href="createForm.htm" data-role="button" data-ajax="false">Create</a>
, :
<script src="/js/jquerymobile/jquery-1.5.min.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled= false;
});
</script>
<link rel="stylesheet" href="/css/jquerymobile/jquery.mobile-1.0a3.min.css" />
<script src="/js/jquerymobile/jquery.mobile-1.0a3.min.js"></script>
, , !
:
http://jquerymobile.com/demos/1.0a3/#page.html&subpageidentifier
Edit:
, , :
<div data-role="header">
<a href="../list.htm" data-icon="arrow-l" data-ajax="false">Back</a>
<h1>
List items
</h1>
</div>