jQuery Mobile pagebeforecreate
Event
Example
Display some text information before the enhancement begins when the page is initializing:
Definition and Usage
The pagebeforecreate
event is triggered before the page initialization and when jQuery Mobile starts enhancing the page.
Note: This event can only be triggered once per page - when the page is first loaded, jQuery Mobile caches the page in the DOM (memory). Therefore, when you navigate back to the first page from a second page via the browser, this event will not be triggered because the first page has already been initialized.
Related Events:
- pagecreate - Triggered after the page is created but before enhancement is complete.
- pageinit - Triggered after the page is initialized and when enhancement is complete.
Syntax
Trigger all page events in jQuery Mobile:
Trigger a specific page event:
Parameter | Description |
---|---|
function(event) | Required. The function to execute after the pagebeforecreate event is triggered. <br> <br>The function is an optional event object containing any jQuery event properties (e.g., event.target, event.type, etc). See 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
, pagecreate
, and pageinit
.