jQuery Mobile pageshowEvent
Examples
Pop up a message after the page is displayed following a page transition:
$(document).on("pageshow","#pagetwo",function(){
alert("pageshow event triggered - displaying page two");
});
alert("pageshow event triggered - displaying page two");
});
Try it Yourself »
Definition and Usage
The pageshow event is triggered after the page is displayed following a page transition.
Related events:
- pagebeforeshowThe event triggered before the page is displayed after a page transition.
- pagebeforehideThe event triggered before the old page is hidden after a page transition.
- pagehideThe event triggered after the old page is hidden after a page transition.
Note:This event is triggered when the page transition starts/ends.
Syntax
Trigger all page events in jQuery Mobile:
$("document").on("pageshow",function(event){...})
Try it Yourself
Trigger a specific page event:
$("document").on("pageshow","page",function(event,data){...})
Try it Yourself
| Parameters | Description |
|---|---|
| function(event,data) | Required. Specifies the function to execute when the pageshow event is triggered. This function contains the following two parameters:
|
| page | Optional. Specifies the page id that the pagebeforehide event points to when triggered. For internal pages, use#id. For external pages, use externalfile.html。 |

More Examples
Related event demonstration.
This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.
Event object
Use the event.type property to return the type of event triggered.
Data object
Use the prevPage property to return the previous page.
Other Extensions
jQuery Mobile Events