I need to find out what page is loaded in query mobile for a javascript script. I have been looking at: $.mobile.activePage but can't seem to work out how.
It would be good to have: if($.mobile.activePage = "#page"){
jQuery Mobile is no longer supported.
jQuery Core is still actively maintained and widely implemented.
However, in jQuery Mobile, Ajax is used to load the contents of each page into the DOM as you navigate, and the DOM ready handler only executes for the first page. To execute code whenever a new page is loaded and created, you can bind to the pageinit event.
$.mobile.activePage
returns a jQuery object. SO you should probably try something like this:
if($.mobile.activePage.attr("id") == "page"){
You can get the currently active page by using $.mobile.activePage
If you want to test that a selected jQuery element is the current page you could look for the existence of the "ui-page-active" class:
if ($("#myPage").is(".ui-page-active")) { ... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With