I am trying to auto click on a button with id btn on page load. This is my snippet.
<button id="btn">Click me</button>
<script>
document.getElementById('btn').click();
alert("h")
</script>
How can I give an alert on page load? Pls help. Thanks.