jQuery Mobile pagebeforecreateEvent
Examples
Pop up some text when the page is initializing, before enhancement begins:
alert("pagebeforecreate \n\tevent triggered!")
});
Try it »
Definition and Usage
The pagebeforeload event is deprecated in jQuery version 1.4.0. You can usepagecontainerbeforeloadevent instead.
The pagebeforecreate event is triggered when the page is initialized and before jQuery Mobile begins enhancing the page.
Note:This event can only be triggered once per page - when the page is loaded for the first time, jQuery Mobile caches the page in the DOM (memory), so when you go back from the second page to the first 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 and before enhancement is complete.
- pageinit- Triggered after page initialization and when enhancement is complete.
Syntax
Trigger all page events in jQuery Mobile:
Trigger a specific page event:
| Parameters | Description |
|---|---|
| function(event) | Required. Specifies the function to execute after the pagebeforecreate event is triggered. The function is an optional event object containing any jQuery event properties (e.g., event.target, event.type, etc.). SeejQuery Event Reference Manualto see more jQuery event properties. |
| page | Optional. Used to specify the page id on 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.
This example demonstrates the triggering of the pagebeforecreate, pagecreate, and pageinit events.
Modify content
Use the pagebeforecreate event to dynamically add attributes.
Event object
Use the event.type property to return the type of the triggered event.
Other extensions
jQuery Mobile Events