Run an event after load a page of a multipage template Jquery Mobile

687 views Asked by At

I have a multipage template in Jquery Mobile, but I'm trying to run an script (an alert for example) after load a page of this template.

The navigation into pages works with "#page1, #page2..."

Thanks a lot.

1

There are 1 answers

0
spezzino On

You can listen for pagebeforeshow or pageload event for example.

$(document).on("pagebeforeshow", function() {
    alert($.mobile.activePage.attr('id')); //this will get the active page id (like #page1)
});​

here is a list of all events http://api.jquerymobile.com/category/events/