JQuery Dialog('open') not working
Here is a sample http://jsfiddle.net/mUpjw/15/
I had JQuery 1.2 in s开发者_Python百科ome old code and it was opening dialog this way.
$('#myDiv').dialog('open');
I upgraded to jquery 1.6.1 and it was working fine . But if I add a DOCTYPE than it doesnt work but if I do
$('#myDiv').dialog();
That works fine.
What can be reason for this ?
You need to setup your dialog box.
<div id="dialog_link">click here</div>
<div id="mydiv" style="display:none;">This is some document here.Will be shown as used 'open'</div>
<div id="mydiv2" style="display:none;">This is some document here</div>
$(document).ready( function(){
$('#mydiv').dialog({
autoOpen: false,
width: 600,
buttons: {
"Ok": function() {
$(this).dialog("close");
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('#dialog_link').click(function() {
$('#mydiv').dialog('open');
return false;
});
This is an option to be used after you have initialized the dialog..
$('#mydiv').dialog({autoOpen: false});
// now you can call it with 'open' to actually show it..
$('#myDiv').dialog('open');
demo at http://jsfiddle.net/gaby/mUpjw/16/
The difference is between the jQuery UI versions and not the jQuery library
精彩评论