title: Trigger enter key press automatically into a text field when page is loaded using javascript
body: <p>I want to trigger enter key pressed in a text field when a page will be loaded.Suppose when user will load the page a text-field will trigger automatically enter key press event means the text field function should remain same as enter key pressed on keyboard.I have a text filed given below.</p>
  
  <pre><code>&lt;input type="text"  id="txt-field" &gt;
  </code></pre>
  
  <p>Manually when user is pressing enter key form key-board one function is executing which is given below. </p>
  
  <pre><code>function scan(){
  alert('hello');
  }
  </code></pre>
  
  <p>But I need this function will execute when page will be load and this text field trigger with enter key event. </p>