jquery ui Dialog: cannot call methods on dialog prior to initialization

后端 未结 11 1995
既然无缘
既然无缘 2020-11-27 02:52

I have an app on jquery 1.5 with dialogs worked fine. While I have a lot of .live handlers, I changed this to .on. For that, I have to update jquery (now 1.8.3 an jquerui 1.

11条回答
  •  没有蜡笔的小新
    2020-11-27 03:47

    Try this instead

    $(document).ready(function() {
      $("#divDialog").dialog(opt).dialog("open");
    });
    

    You can also do:

    var theDialog = $("#divDialog").dialog(opt);
    theDialog.dialog("open");
    

    That's because the dialog is not stored in $('#divDialog'), but on a new div that is created on the fly and returned by the .dialog(opt) function.

提交回复
热议问题