I use the following code to create a dialog using JQUERY / UI:
var $dialog2 = $('<div id="sharerdialog2"></div>')
.html('<p>Loading...</p>')
.dialog({
autoOpen: false,
title: 'Image Stuffer',
position: ['center',150],
width: 450,
focus:function(event, ui) {
$('#dialogcloser').click(function() {
$dialog.dialog('close');
});
},
open: function(event, ui) {
$("#sharerdialog2").load("MyURL.com");
}
});
I am trying to call a dialog to open it, but JQUERY does not find it using the following:
$dialog2.dialog('open');
Strange if I add the following after the above, it works on BIND:
$('#ttttt').click(function() {
$dialog2.dialog('open');
});
Any ideas why this is so? How can I call a dialog to open in another function?
thank
source
share