First things first here is my js
$(document).ready(function(){
$('<a>Launch</a>').attr({'href':'#popupBasic','data-rel':'popup','data-transition':'pop','class':'ui-btn ui-corner-all ui-shadow ui-btn-inline'}).appendTo('body')
$("<div></div>").attr({'data-role':'popup', 'id':'popupBasic'}).appendTo('body')
$('#popupBasic').html('<iframe src="http://www.example.org"></iframe>')
});
Through testing I have narrowed the problem down to the iframe. For whatever reason when I use jQuery to create the iframe and append it the div that is when it stops functioning.
I'm not sure why this is. I have tried using both appendTo and .html as shown above both with no success.
My question is what is the correct way to dynamically create the iframe that will allow this code to work as intended?
For jQM you should append to a page div and not the body. A page looks like this:
Next instead of document.ready, use the jQM page events like pagecreate, And after adding the popup to the page, you need to tell jQM to initialize the widget by calling .popup():