Event Pagecreate
# jQuery Mobile pagecreate Event
[ jQuery Mobile Events](#)
## Example
Alert a message when the page is initialized, before enhancement is complete:
$(document).on("pagecreate",function(){
alert("pagecreate event triggered!")
});
[Try it Β»](#)
* * *
## Definition and Usage
The pagecreate event is triggered after a page is successfully created, but before jQuery Mobile has enhanced 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 navigate back to the first page from the second page via the browser, this event will not be triggered, because the first page has already been initialized.
**Note:** Before version 1.4, we used the pageinit event (deprecated) for this purpose.
**Tip:** This event is typically used when users want to enhance custom components:
$(document).on("pagecreate","#pagetwo",function(event){ $.(":jqmData(role='my-plugin')").myPlugin();});
**Related Events:**
- Triggered after page initialization, but before page enhancement.
- Triggered after the page has been fully initialized and enhanced.
* * *
## Syntax
Trigger event for all pages in jQuery Mobile:
$("document").on("pagecreate",function(event){...}) (#)
Trigger event for a specific page:
$("document").on("pagecreate","_page_",function(event){...}) (#)
| Parameter | Description |
| --- | --- |
| function(event) | Required. Specifies the function to run when the pagecreate event is triggered. The function has an optional event object, which can contain any jQuery event properties (event.target, event.type, etc.). For more information, see the (#). |
| _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
(#)
This example demonstrates the triggering of the pagebeforecreate and pagecreate events.
(#)
Use the event.type property to return the type of event triggered.
* * jQuery Mobile Events](#)
YouTip