Jquery mobile javascript on another html not working -
so have 2 pages example page1.html , page2.html. there href link in page1 page2. seems javascript in page2.html ignored , not called. (tried document ready, body onload did not work)
so jquery mobile accept javascripts on first page?
how run javascript after page2.html called?
new jquery mobile thanks.
sample code on page2.html similar page 1:
<meta name="viewport" content="width=device-width, user-scalable=no" /> <link rel="stylesheet" type="text/css" href="css/index.css" /> <link rel="stylesheet" href="css/jquery.mobile-1.3.1.min.css"> <script type="text/javascript" src="cordova-2.5.0.js"></script> <script type="text/javascript" charset="utf-8" src="js/imageresize.js"></script> <link rel="stylesheet" href="css/jquery.jcrop.min.css" type="text/css" /> <script src="js/jquery.-1.10.1.min.js"></script> <script> $(document).bind("mobileinit", function(){ $.extend( $.mobile , { defaultpagetransition:'none' }); }); </script> <script src="js/jquery.mobile-1.3.1.min.js"></script> <body> hello world </body> <script> $(function() { alert('testing js'); }); </script>
everything need know problem can found here: why have put script index.html in jquery mobile
to understand situation need understand how jquery mobile works. uses ajax load other pages.
first page loaded normally. head
, body
loaded dom
, , there await other content. when second page loaded, only body
content loaded dom
.
that's why button show click event not working. same click event parent head
disregarded during page transition.
here's official documentation: http://jquerymobile.com/demos/1.2.0/docs/pages/page-links.html
unfortunately not going find described in documentation. ether think common knowledge or forgot describe other topics. (jquery mobile documentation big lacking many things).
Comments
Post a Comment