Is there a way to capture the alert ok button click event?

Viewed 53462

Is there a way to capture the alert ok button click event? In jQuery?

6 Answers

Alert is a blocking function, means, if you don't close it, the code below will not execute. So you don't have to capture the alert close event, just write down the code below that alert, when alert window will be closed the code below will be executed automatically.

See example below:

alert("Close Me");
// Write down the code here, which will executed only after the alert close
console.log("This code is executed after alert")

Related