Easy Tutorial
❮ Jquerymobile Navbars Event Pagebeforecreate ❯

jQuery Mobile pageinit Event

jQuery Mobile Events

Example

Display a message when the page is initialized and enhanced:


Definition and Usage

The pageinit event is triggered after the page has been initialized and jQuery Mobile has completed enhancing the page content.

Use this event instead of the jQuery DOM ready event, as it will trigger regardless of whether the page is loaded directly or via Ajax.

Note: This event is only triggered once per page - when the page is first loaded. jQuery Mobile caches the page in the DOM (memory), so when you navigate back to the first page from a second page, the event will not be triggered again, as the first page has already been initialized.

Related Events:


Syntax

Trigger all page events in jQuery Mobile:

Trigger a specific page event:

Parameter Description
function(event) Required. The function to execute after the pageinit event is triggered. <br> <br> The function is an optional event object containing any jQuery event properties (e.g., event.target, event.type, etc). Refer to the jQuery Event Reference
page Optional. Specifies the page ID for which the pagebeforecreate event is triggered. For internal pages, use #id. For external pages, use externalfile.html.

More Examples

Demonstration of pagebeforecreate and pagecreate events.

Event Object


jQuery Mobile Events

❮ Jquerymobile Navbars Event Pagebeforecreate ❯