[英]Close button on Jquery Dialog
I have a custom alert ui setup for jquery-ui, but for some reason my close button doesn't close the window. 我有一个针对jquery-ui的自定义警报ui设置,但由于某种原因,我的关闭按钮无法关闭窗口。 Below is my code. 下面是我的代码。 I am attempting to utilize the override alert() with jQuery UI as mentioned in this link. 我正在尝试使用此链接中提到的jQuery UI的override alert()。 Any assistance is appreciated. 任何帮助表示赞赏。 https://andrewensley.com/2012/07/override-alert-with-jquery-ui-dialog/ https://andrewensley.com/2012/07/override-alert-with-jquery-ui-dialog/
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script type ="text/javascript">
window.alert = function (message) {
$(document.createElement('div'))
.attr({ title: 'Invoice Information', 'class': 'alert' })
.html(message)
.dialog({
draggable: true,
modal: true,
resizable: false,
width: 'auto',
buttons: {
OK: function () {
$(this).dialog("close");
}
},
close: function () { $(this).remove();}
});
};
</script>
我只需将渲染器和脚本链接移动到标题中,然后将JS脚本移动到正文中,即可解决问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.