jQuery pagecreate Event
Alert some text when the page has been created, but before enhancement is complete:
alert("pagecreate event fired!")
Try it yourself »
Definition and Usage
The pagecreate event is triggered when the page has been created in the DOM (via ajax or other), but before jQuery Mobile has finished enhancing the page.
Tip: This event is most used for user's that want to create their own custom widget enhancement:
Note: This event is only triggered once per "page" - Every time a page is loaded for the first time, jQuery Mobile caches pages in the DOM (memory), so when you navigate back from pagetwo to pageone (for example), this event will not fire, because then, pageone is already initialized.
- pagebeforecreate - triggered when the page is about to be initialized, but before enhancement has begun
- pageinit - triggered when the page has been initialized and enhancement is complete
To trigger the event for all pages in jQuery Mobile:
To trigger the event for a specific page:
|function(event)||Required. Specifies the function to run when the pagecreate event occurs
The function has an optional event object, which can contain any jQuery event properties (e.g. event.target, event.type, etc.) See jQuery Events Reference for more information.
|page||Optional. Points to the id of the page to specify the pagecreate event for. For internal pages, use #id. For external pages, use externalfile.html.|
Try it Yourself - Examples
A demonstration of pagebeforecreate, pagecreate and pageinit
A demonstration that shows when pagebeforecreate, pagecreate and pageinit fire.
The event object
Using the event.type property to return the triggered event type.
Thank You For Helping Us!
Your message has been sent to W3Schools.