Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery Mobile Events

jQuery Mobile Events


Events = the response actions to all the different ways visitors access a page.


jQuery Mobile Events

In jQuery Mobile you can use any standard jQuery events 。

In addition, jQuery Mobile also provides events for mobile browsers:


Initialize jQuery Mobile Events

When learning jQuery we learned to use $(document).ready() to make your jQuery code start executing only after the DOM elements have loaded:

jQuery document ready Event

Try it »

However, in jQuery Mobile, the pageinit event is used to set code to start executing after DOM elements have loaded, so to execute scripts when any new page is loaded and created, you need to bind the pageinit event.

The second parameter ("#pageone") specifies the id of the page for the event:

jQuery Mobile pagecreate event

Try it »

lamp  Note: The jQuery on() method is used to bind events to selected elements.

In the next chapter we will introduce jQuery Mobile events in more detail.