jQuery-UI close modal dialog on background click

后端 未结 5 2246
忘掉有多难
忘掉有多难 2021-02-14 16:09

I\'m toying with jQuery UI, and I like how this demo works: http://jqueryui.com/demos/dialog/#modal-message

However, when a dialog comes up, the only way to close it is

5条回答
  •  粉色の甜心
    2021-02-14 16:13

    That should do the trick:

    $(".ui-widget-overlay").click(function(){
        $(".ui-dialog-titlebar-close").trigger('click');
    });
    

    Click on .ui-widget-overlay will trigger the click on the close button

    Cheers

    G.

提交回复
热议问题