title: Javascript - Auto click on a button on page load
body: <p>I am trying to auto click on a button with id btn on page load. This is my snippet.</p>
  
  <pre><code>&lt;button id="btn"&gt;Click me&lt;/button&gt;
  &lt;script&gt;
  document.getElementById('btn').click();
      alert("h")
  &lt;/script&gt;
  </code></pre>
  
  <p>How can I give an alert on page load? Pls help. Thanks.</p>