jQuery Mobile - can't bind pagebeforechange to page id?
问题 I could only ever bind pagebeforechange to the entire jquery mobile document, not an individual page. Can anyone explain why this doesn't work? 回答1: $("div[data-role='page']").live( "pagebeforehide", function( event ) { alert('This alert should trigger before Next Page Here is shown?'); }); (check the link for details) you can also use bind instead of live , Hope it helped. 回答2: Selector for JQM pages: $('.ui-page') Adding the event listener to all the pages in the document can be done as: $