Reputation: 5961
i have created a handler to trap pageshow for multiple ages like so
$(document).on('pageshow',"#novels, #book, #toys",function(event){
}
each page has an id like so
<div data-role="page" data-theme="c" id="pagename"></div>
how do i get the pages that call the pageshow events, i tried
console.log($(this).attr('id'));
in the pageshow evens, but got undefined
in the console
Upvotes: 0
Views: 97
Reputation: 31732
$(document).on("pageshow", function () {
var activePage = $.mobile.activePage[0].id;
console.log( activePage ); // pageID of active page
});
$(document).on("pagecontainershow", function () {
var activePage = $.mobile.pageContainer.pagecontainer("getActivePage")[0].id;
console.log( activePage ); // pageID of active page
});
Upvotes: 2