jQuery Mobile pagecontainerload
Event
Example
Display a text message after the page has been successfully loaded and inserted into the DOM:
$(document).on("pagecontainerload", function(){ alert("pagecontainerload event triggered!"); });
Definition and Usage
The pagecontainerload
event is triggered after the page has been successfully loaded and inserted into the DOM.
Related Events:
pagecontainerbeforeload - Triggered before the request to load.
pagecontainerloadfailed - Triggered if the page request fails.
Note: This event is for external pages - after the page is loaded and inserted into the DOM, two events will be triggered. The first event is pagecontainerbeforeload
, and the second event could be either pagecontainerload
or pagecontainerloadfailed
.
Syntax
$("document").on("pagecontainerload", function(event, data){...})
Parameter | Description |
---|---|
function(event, data) | Required. Specifies the function to run when the event is triggered. The function has two optional parameters: event object - Contains jQuery event properties (e.g., event.target, event.type, etc.), see jQuery Event Reference for more information. data object - Contains the following: url (string) - The absolute or relative URL address of the page (sent to $.mobile.loadPage())<br> absUrl (string) - The absolute path of the URL<br> dataUrl (string) - The URL address corresponding to the browser<br> deferred (object) - Contains resolve() or reject()<br> options (object) - Optional parameters sent to $.mobile.loadPage(). Note: You can manually handle the request by calling event.preventDefault() in the event object, and the deferred object in the data object contains resolve() or reject() methods. |