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

Using changePage() to change a page

This recipe shows you how to use the $.mobile.changePage() method to change from one page to another using JavaScript. This recipe extends the Using a split button list recipe from Chapter 6, List Views, and displays the selected image from the list item in a new page.

Getting ready

Copy the full code of this recipe from the code/09/changepage source folder. Also, revisit the Using a split button list recipe from Chapter 6. You can launch this code by using the URL: http://localhost:8080/09/changepage/main.html.

How to do it...

  1. Create main.html with a split button list, with the href attribute for the <img> tag having a file parameter, with the path for the image file in the left button, as follows:
    <div data-role="content"> ...

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