O'Reilly logo

jQuery Mobile Cookbook by Chetan K Jain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Page change events

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.

Getting ready

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.

How to do it...

Carry out the following steps:

  1. Create main.html with two links to open two dialogs and an empty div element in its page content, as follows:
    <div id="content" data-role="content"> <a href="#dialog1" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required