[英]jQuery on click have to click twice for modal dialog to appear
我正在使用对话框。 当我单击以打开对话框时,我总是必须单击两次。 我已经尝试了许多解决方案,但无法正常工作。
jQuery(result).on('click', function() {
jQuery(why).dialog({
create: function (event, ui) {
jQuery(".ui-corner-all").css('border-radius','0px !important');
},
autoOpen: true,
title: "Whois Info",
width: 1170,
height: 600,
modal: true,
buttons: {
Close: function() {jQuery(this).dialog("close");return false;}
}
});
});
您无需每次单击按钮就初始化对话框。 将初始化部分移到document.ready函数中。 然后在click函数内部编写代码以使对话框可见。
就像是:
$( function() {
jQuery("#id").dialog({
create: function (event, ui) {
jQuery(".ui-corner-all").css('border-radius','0px !important');
},
autoOpen: true,
title: "Whois Info",
width: 1170,
height: 600,
modal: true,
buttons: {
Close: function() {jQuery(this).dialog("close");return false;}
}
});
jQuery(result).on('click', function() {
jQuery("#id).dialog('open');
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.