Reputation: 8457
Suppose I use a lot of alerts during troubleshooting and rather than go back through and remove them all, I would just rather turn them all off? Can it be done? Maybe by re-writing the `alert.prototype?
Upvotes: 0
Views: 104
Reputation: 48972
I guess you need something like:
var oldAlert = window.alert;
window.alert = function(){
if (enableAlertFunction){
oldAlert.apply(window,arguments);
}
}
enableAlertFunction
is to toggle on/off all your alert
. Remember to run this code first before all the code on your page.
Upvotes: 1