I'm dynamically creating jquery mobile pages, and the only page that seems to be showing is the first one I create. All the html elements are being created. I tried using...
$.mobile.changePage("#page2");
Nothing happened
So I tried using
$("#page1").hide();
$("#page2").show();
With this code page1 would hide, but page2 would not show.
I also tried combining them
$("#page1").hide();
$("#page2").show();
$.mobile.changePage("#page2");
Strings to generate html pages inside the sections.
"<div data-role=\"page\" id=\"page1\" data-theme=\"b\" data-content-theme=\"b\"><h1>Page 1</h1></div>"
"<div data-role=\"page\" id=\"page2\" data-theme=\"b\" data-content-theme=\"b\"><h1>Page 2</h1></div>"
This is the generated html:
<body>
<section id="index_page" class="ui-mobile-viewport ui-overlay-b" style="display: none;"><!-- Start of home page --><div data-role="page" id="page1" data-theme="b" data-content-theme="b" data-url="index" tabindex="0" class="ui-page ui-page-theme-b ui-page-active" style="min-height: 901px;"><h1>Page 1</h1></div><div class="ui-loader ui-corner-all ui-body-a ui-loader-default"><span class="ui-icon-loading"></span><h1>loading</h1></div></section><section id="page2" style="display: block;"><div data-role="page" id="page2" data-theme="b" data-content-theme="b"><h1>Page 2</h1></div></section>
</body>
Any idea what I might be missing, or if this is a bug with jquery mobile and dynamically created html?