I have one file for each page, and I'm trying to implement an event handler on the page on each page (I think that what belongs to exactly one page should be declared there), as shown below:
<body> <div id="myPage" data-role="page"> <script type="text/javascript"> $("#myPage").live('pageinit', function() { </script> </div> </body>
The event is correctly attached to the page, so the code is executed, but now my problem is if I go to another page and come back later, the pageinit event will be executed twice. I think this is because the .live method binds the pageinit event to the page again. But should the pageinit event be raised only once when the page is initialized? What am I missing here?
source share