From the course: jQuery Mobile Essential Training

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Page initialization and load events

Page initialization and load events - jQuery Mobile Tutorial

From the course: jQuery Mobile Essential Training

Start my 1-month free trial

Page initialization and load events

There are two different sets of events that deal with page-related events. There are events for initialization and loading, and there are events for transitions, which I'll cover separately. So you can see here in the snippets I've scrolled down in chapter 7 to the Page init events area. So, let's go ahead and open pageinit_start. And let's copy in this script block right here, and we'll paste it in above the meta tag. Now remember, this is not the mobile init event. That only gets called once when the library itself loads. These are per page events. So, I'm listening in for the pagebeforecreate event and then I'm listening in for the pagecreate event, and I'll need to put a little space there. There we go. So, what we're going to do is listen in for both before creation and creation itself. And this is useful in the case, for example, where your application maybe wants to listen in for a page being created before it kicks off a request for some data via Ajax to your server, or tries…

Contents