Reputation: 169
I want to transition to an external jquery mobile page, but none event is getting trigger, when the transition is called:
jQuery("#test1").on("pagebeforeshow", function(event) {
WL.Logger.debug("pagebeforeshow: test1");
});
function loadHTML(){
$.mobile.pageContainer.pagecontainer("load", "./pages/test1/test1.html", {});
}
function openHTML(){
$.mobile.pageContainer.pagecontainer("change", "./pages/test1/test1.html", {});
}
and this is the content on my HTML :
<div data-role="page" id="test1">
<div data-role="content" style="padding: 15px"></div>
</div>
Is there any way to use any event?
Upvotes: 0
Views: 101
Reputation: 24738
To attach the pagebeforeshow handler to a page not loaded into the DOM yet, you must use event delegation:
https://learn.jquery.com/events/event-delegation/
jQuery(document).on("pagebeforeshow", "#test1" function(event) {...
Upvotes: 1