[英]how to stop showing alert box after overriding alert function
我使用此代码重写警报功能,但在使用此代码显示我的自定义警报框后,它同时显示了两者如何停止默认警报框? 使用preventDefault(); ? 哪里?
(function(event) {
var proxied = window.alert;
window.alert = function(str) {
bootbox.alert(str);
return proxied.apply(this, arguments);
};
})();
您用于覆盖默认alert function
代码包含另一个警报功能bootbox.alert(str);
因此,它进入无限循环,显示too much recursion error.
您可以尝试使用以下代理模式进行覆盖。
(function(event) {
var proxied = window.alert;
window.alert = function(str) {
//Your code here
proxied.apply(this, arguments);
return true;
};
})();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.