gpt4 book ai didi

javascript - 覆盖 javascript ALERT to jquery 对话框

转载 作者:行者123 更新时间:2023-11-30 07:09:28 25 4
gpt4 key购买 nike

我试图施展魔法,将我所有的平台 javascript 警报转换为 jquery 对话框,我遵循了以下脚本

<div id="overrideAlert"></div>

<script>
window.alert = function(message) {
$('#overrideAlert').text(message).dialog({
modal:true,
title:'Message',
buttons: {
'OK':function(){
$(this).dialog('close');
}
}
});
};
</script>

但运气不好。

是否有一个干净的解决方案?谢谢,

最佳答案

我更喜欢动态 div 而不是

$('<div />').text(message).dialog({
modal:true,
title:'Message',
buttons: {
'OK':function(){
$(this).dialog('close');
}
},
close:function(){ $(this).dialog('destroy').remove(); }
});

DEMO.

关于javascript - 覆盖 javascript ALERT to jquery 对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16312090/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com