The jQuery Mobile framework triggers the page load events whenever an external page is loaded into the DOM. It fires the pagebeforeload
event
before loading the page and then fires either the pageload
or pageloadfailed
event
based on the status of the page load. The pageremove
event
is fired when a page is removed from the DOM. This recipe shows you how to use the page load and page remove events.
Copy the full code of this recipe from the code/08/pageload
sources folder. You can launch this code using the URL http://localhost:8080/08/pageload/main.html
.
Carry out the following steps:
Create
main.html
with four buttons and an emptydiv
element, as shown in the following code snippet:<div id="content" data-role="content"> <a href="page1.html" data-role="button" data- inline="true">Page 1</a> <a href="page2.html" data-role="button" data- inline="true">Page 2</a> <a href="page3.html...