Note that there are some explanatory texts on larger screens.

plurals
  1. POFunky pagecreate issue with jQueryMobile
    text
    copied!<p>Here is my simplified code which has two pages which link to each other. The result is the page2 count alert always says there is one #page2 div in the DOM. However pagecreate fires for each time that page2.html has been referenced. First time is 1, second time is 2, and so on...</p> <p>Can someone explain what is going on and how to get one pagecreate event for page2?</p> <pre><code>index.html &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /&gt; &lt;meta http-equiv="Content-type" content="text/html; charset=utf-8" /&gt; &lt;link rel="stylesheet" href="jquery.mobile-1.0.1.min.css" /&gt; &lt;script src="jquery-1.6.4.min.js"&gt;&lt;/script&gt; &lt;script src="jquery.mobile-1.0.1.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page"&gt; &lt;div data-role="content"&gt; &lt;h3&gt;In Index Page&lt;/h3&gt; &lt;a href="page2.html" data-role="button"&gt;Go To Page2&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; page2.html &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="page2" data-role="page"&gt; &lt;div data-role="content"&gt; &lt;a href="index.html" data-role="button"&gt;Back&lt;/a&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; alert("page2 count is " + $("#page2").length); $("#page2").live('pagecreate',function(event, ui) { alert("in page2 on pagecreate"); }); &lt;/script&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; Thanks, -- Ed </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload