Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
CHAPTER 27 PAGES AND NAVIGATION }); </script> <script type="text/javascript" src="jquery.mobile-1.0.js"></script> </head> <body> <div id="page1" data-role="page"> <div data-role="header"> <h1>Jacqui's Shop</h1> </div> <div data-role="content"> <a href="document2.html">Go to document2.html</a> </div> </div> </body> </html> In this example, I register a handler function for the pagehide event on the page1 element, by selecting the element I want and calling the bind method. This means I will receive the event only when that selected page is hidden. This is a pretty dumb example, because it simply uses the changePage method to return to page1 whenever the pagehide event is triggered, but it does demonstrate the use of the event. Notice that I am still using a variable to ensure that I register my handler function only once. If I did not do this, then two functions would be registered for the same event on the same element when document2.html page is loaded.