Cannot call methods on dialog prior to initialization -


i trying open div in jquery dialog. after opening div dialog, when click on overlay area, error.

cannot call methods on dialog prior initialization. attempt call method 'close'.

here tried far:

<div class="mydiv"></div> var options = {   modal: true,   draggable: true,   resizable: false,   position: "center",   buttons: {     ok: function () {       $(this).dialog("close");     }   },   close: function () {     $(".ui-dialog").remove();   } }; var dg = $(".mydiv").dialog(options); $(dg).dialog("open"); 

//document.ready

$(".ui-widget-overlay").live("click", function () { $(".mydiv").dialog("close"); }); 

there may many div same class name ".mydiv".

the buttons property takes array of objects define text property , click property containing event handler.

var options = {   modal: true,   draggable: true,   resizable: false,   position: "center",   buttons: [{     "text": "ok",     "click": function () {       $(this).dialog("close");     }   }],   close: function () {     $(".ui-dialog").remove();   } }; 

for more information checkout documentation.

working example http://jsfiddle.net/unwzc/


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -