The jQuery Mobile framework triggers page change events whenever a page is loaded by the $.mobile.changePage()
method into the DOM. The
pagebeforechange
event is fired first, before the page changes. Then, either the
pagechange
event (on success) or the pagechangefailed
event
(on failure) is fired. This recipe shows you how to use the page change events.
Copy the full code of this recipe from the code/08/pagechange
sources folder. You can launch this code using the URL http://localhost:8080/08/pagechange/main.html
.
Carry out the following steps:
Create
main.html
with two links to open two dialogs and an emptydiv
element in its page content, as follows:<div id="content" data-role="content"> <a href="#dialog1" data-role="button">Dialog 1</a> <a href="#dialog2" data-role="button">Dialog 2</a> <div id="msgdiv"></div> </div>