When I create a whole new page in jQuery Mobile the page gets created, but when I click the link with the id linking to the just created page, it does not work. The list item link stays selected (blue, in the standard theme), but the page itself does not load.
The page gets created by appending it to the body:
$('body').append('<div id="' generatedId '" data-role="page"><div data-role="header"><h2>Page</h2></div><div data-role="content">content</div></div>');
When I turn off jQuery Mobile you can clearly see that the page gets created, but with jQM on it cannot be accessed.
What am I doing wrong?
$('body').append('<div id="'+ generatedId +'" data-role="page"><div data-role="header"><h2>Page</h2></div><div data-role="content">content</div></div>').trigger('create');