I'm new to JS, so please be patient.
I have this alert pop-up window and I would like to write a piece of code that clicks the OK button inside it whenever it comes up. How can I do it?
Here's my code:
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript Alert</h2>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
alert("I am an alert box!");
}
</script>
</body>
</html>