Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery Dialog('open') not working

Here is a sample http://jsfiddle.net/mUpjw/15/

I had JQuery 1.2 in some 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 ?

like image 933
Pit Digger Avatar asked Aug 02 '11 20:08

Pit Digger


1 Answers

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;
});
like image 174
Caimen Avatar answered Oct 13 '22 07:10

Caimen