jQuery UI dialog - problem with event on close

前端 未结 3 464
刺人心
刺人心 2021-01-15 23:25

I\'m trying to perform a specific action when I close a jQuery UI dialog. Here\'s a simplified version of my code:

$(\'a.open-trigger\').click(function(){
           


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-16 00:00

    You are attaching additional event handlers every time you call .click. That is why it is duplicating.

    $('a.close-trigger').click(function(){
                        alert(test);
                        $('#dialog').dialog('close');
                });
    

    Pull that code out onto the same level as the other event binding and it should work as expected.

提交回复
热议问题