jQuery.mobile.changePage problem, version 1.3.2
I have a strange problem with jQuery.mobile.changePage. Here is an example.
i have a function which creates a page dynamically and put contents on it, then use jQuery.mobile.changePage to show it. let's say the function is called
function createPage() {
var pageid="dpage";
// here is some code to check if "#dpage" is already in the dom, if not create it
var page = jQuery("<div data-role='page' id='dpage'></div>").appendTo(document.body);
// now put a back button
var back = jQuery("<a href='#' data-role='button' data-rel='back' data-icon='back' data-iconpos='right'>Back</a>").appendTo(page);
// now put more content to page
// now show the page
jQuery.mobile.changePage("#dpage", {transition:"slide", changeHash:true});
}
the strange thing is that I have two single page documents, page1 and page2.
let's say page1 is my main stuff. so i load page1 first
in page 1,
i include all the javascript and css files in the header section
and when i call createPage, it works fine.
now, from page1, i click a link to go to page2 (in another file)
in page 2,
when i call createPage, it just does not show the page, inspected the dom,
the div with id dpage is there, all the things are fine. but the page just does not show up
now if i load page2 by itself, which has all the javascript and css files in its header
here, if i call createPage, it works fine.
kine strange. any idea what's going on?
thanks in advance.