I've tried the following on JSFiddle:
HTML:
<div id="dialog" title="Basic dialog">
<p>Hello.</p>
</div>
<a href="www.google.com">Link</a>
JavaScript
$(document).ready(function() {
$( "#dialog" ).dialog({ autoOpen: false });
$(document.body).on('click',"a",function(event){
if ($(this).hasClass('ui-dialog-titlebar-close')) return;
event.preventDefault();
$("#dialog").dialog('open');
});
});
I want to achieve this same functionality, but by creating the dialog via JavaScript. That is, I don't want to have the <div id="dialog" ...>
in the HTML. How can I do that?
onLoad