Is there a way to capture the “alert()” box from normal javascript in jquery, such that when the user clicks “OK” I can fire a function?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have come up with a better way to do it, and It’s done by replacing the function called within the alert function, i’m sure there’s a better way to store the previous function, but here it is;
It also works on ie8 which is what you wanted I guess.
(Basically it means that any call to alert() will return false unless stopAlerts is set to false. If you want alerts to be off by default, then call changeAlertStatus() within the window.onload function. This answer isn’t using jquery, but I guess you could add it with document.ready rather than window.onload)
(it also means that you can create custom alerts too i guess, with your own interface)