Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I just tested on my local machine and this works for me:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.6.1.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"&gt;&lt;/script&gt; &lt;script&gt; function create_page(page_name) { $('body').append('&lt;div data-role="page" id="' + page_name + '"&gt;&lt;div data-role="content"&gt;Some content in here.&lt;/div&gt;&lt;/div&gt;'); //EDITED OUT, SEE BELOW $.mobile.changePage($('#' + page_name)); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div data-role="page"&gt; &lt;div data-role="content"&gt; &lt;a href="javascript:create_page('test_page_name');" data-role="button" style="padding:15px; font-size:30px;"&gt;TEST TEXT&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>----EDIT---- also have this function:</p> <pre><code>function change_page(page_name) { $.mobile.changePage($('#' + page_name)); } </code></pre> <p>and use it to change to the dynamically created pages like so:</p> <pre><code>&lt;a href="javascript:change_page('test_page_name');" data-role="button" style="padding:15px; font-size:30px;"&gt;Change Page&lt;/a&gt; </code></pre> <p>There was some strange behavior with trying to link to the dynamically created page using a hash (href="#test_page_name"). In firebug I saw that the create a page function properly appended the new page onto the body, but the change page button would create another page with the same id as the original page but a data-url that was set properly. The data-role=page div created by clicking on the change page link also had the same content as the first div, and the page created by the create_page function was just ignored.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

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