我的对话框在 div 下定义。
#dialogbox
当对话框打开时,我希望触发一个事件,以便它弹出一个警告。我正在使用的代码是:
当对话框打开时,我想触发一个事件,使其弹出警告。我正在使用以下代码:
$("#dialogbox").dialog({open: function(){
alert("OPEN");
}
});
但是当打开对话框时似乎不会触发这个
请帮忙。我的对话框在 div 下定义。
#dialogbox
当对话框打开时,我希望触发一个事件,以便它弹出一个警告。我正在使用的代码是:
当对话框打开时,我想触发一个事件,使其弹出警告。我正在使用以下代码:
$("#dialogbox").dialog({open: function(){
alert("OPEN");
}
});
但是当打开对话框时似乎不会触发这个
请帮忙。$( ".selector" ).dialog({
open: function( event, ui ) {}
});
或者事件监听器 .on
$( ".selector" ).on( "dialogopen", function( event, ui ) {} );
本页面提供更多信息:
HTML:
<div id="dialogbox"></div>
<input id="mybutt" type="button" value="Click Me">
Javascript / jQuery:
$("#dialogbox").dialog({
autoOpen:false,
modal:true,
title: "Use of Open event",
width:300,
open: function( event, ui ) {
alert('hello');
}
});
$('#mybutt').click(function() {
$('#dialogbox').html('<h2>Watch this</h2>An alert box should have opened');
$('#dialogbox').dialog('open');
});
$( "#WaitingDialog").html("Message you want to display").dialog({
modal: true,
buttons: {
Ok: function() {
alert("hello");
}
}});
$( "#WaitingDialog").html("Message you want to display").dialog({
modal: true,
buttons: {
open: function( event, ui ) {
alert('hello');
}
}});