pageshow event not working
I can't seem to get the pageshow event to work. The html below is the page that I am navigating to with the pageshow event wired up. However when the page opens the alert is not invoked. I'm sure I've done something wrong but I can't work out what?
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title></title>
- <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
- <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
- <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
- </head>
- <body>
- <div id="mypage" data-role="page" data-theme="b">
- <div data-role="header">
- <h1>Page 2</h1>
- </div>
- <div data-role="content">
- <p>This is page 2.</p>
- </div>
- </div>
- <script type="text/javascript" language="javascript">
- $('mypage').live('pageshow', function (event, ui) {
- alert('This page was just hidden: ' + ui.prevPage);
- });
- </script>
- </body>
- </html>