How to find out if jquery dialog was closed on escape and execute some code

我的未来我决定 提交于 2019-12-01 21:04:11

After googling around without finding an answer (and that's why I asked the question Q&A style) I started looking into close: function( event, ui ) part and found the solution using event.originalEvent

close: function( event, ui ) {
    //some_code();
    if(event.originalEvent ){
        // triggered by clicking on dialog box X or pressing ESC
        // not triggered if a dialog button was clicked
        some_code();
    }        
    $(this ).dialog( 'destroy' )
    }

hope this helps somebody, here's the fiddle: http://jsfiddle.net/hbrunar/MXk3a/2/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!