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

后端 未结 11 1917
既然无缘
既然无缘 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条回答
  •  -上瘾入骨i
    2020-11-27 03:47

    The new jQuery UI version will not allow you to call UI methods on dialog which is not initialized. As a workaround, you can use the below check to see if the dialog is alive.

    if (modalDialogObj.hasClass('ui-dialog-content')) {
        // call UI methods like modalDialogObj.dialog('isOpen')
    } else {
        // it is not initialized yet
    }
    

提交回复
热议问题