YouTip LogoYouTip

Event Pagehide

jQuery Mobile pagehide Event

jQuery Mobile pagehide Event

jQuery Mobile Events jQuery Mobile Events

Example

Display an alert message after the old page is hidden following a page transition:

$(document).on("pagehide","#pagetwo",function(){
    alert("pagehide event triggered - Page Two hidden");
});

Try it yourself Β»


Definition and Usage

The pagehide event is triggered after the old page is hidden following a page transition.

Related Events:

  • pagebeforehide - Triggered before the old page is hidden following a page transition.
  • pagebeforeshow - Triggered before the new page is displayed following a page transition.
  • pageshow - Triggered after the new page is displayed following a page transition.

Note: This event is triggered every time a page transition starts/stops.


Syntax

Trigger the event for all pages in jQuery Mobile:

$("document").on("pagehide",function(event){...})

Try it

Trigger the event for a specified page:

$("document").on("pagehide","_page_",function(event,data){...})

Try it

Parameter Description
function(event,data) Required. Specifies the function to run when the pagehide event is triggered. This function contains the following two parameters:
  • event object - Contains any jQuery event properties (event.target, event.type, etc.). For more information, see the jQuery Event Reference.
  • data object - Contains the property nextPage, which is the page transitioning to.
_page_ Optional. Specifies the page ID that the pagehide event points to when triggered. For internal pages, use #id. For external pages, use externalfile.html.

More Examples

Related Events Demo

This example demonstrates the triggering of the pagebeforeshow, pageshow, pagebeforehide, and pagehide events.

Event Object

Using the event.timeStamp property.

Data Object

Using the nextPage property to return the transitioning page.


jQuery Mobile Events jQuery Mobile Events

← Event PageinitEvent Pagecreate β†’