对话框打开时触发事件 [英] Trigger event on dialog box open

查看:215
本文介绍了对话框打开时触发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的对话框在div下定义

My dialog box is defined under the div

#dialogbox

当对话框打开时,我想触发一个事件以使其警报打开.我使用的代码是:

When the dialog box opens i want to trigger an event such that it alerts open. The code im using is:

$("#dialogbox").dialog({open: function(){
           alert("OPEN");
          }
});

但是打开对话框时似乎不会触发 请帮助

But this doesnt seem to trigger when dialog box is opened Please help

推荐答案

您可以使用:

$( ".selector" ).dialog({
  open: function( event, ui ) {}
});

或事件监听器.on

$( ".selector" ).on( "dialogopen", function( event, ui ) {} );

此页面中的更多信息:

http://api.jqueryui.com/dialog/#event-open

这篇关于对话框打开时触发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆