title: How to fire enter button event dynamically using pure javascript
body: <p>I have an input it has a function running if the keycode ==13 </p>
  
  <p>I also have a button on the same page if the user clicks that button it should trigger click event associated with it and at the same time it should also fire the enter click using javascript </p>
  
  <p>the code is shown as below </p>
  
  <pre><code>&lt;input type="text" class="myInputValue"&gt;
  &lt;button class="myLink"&gt;submit&lt;/button&gt;
  
  (function(){
    var inputc = document.getElementsByClassName('myInputValue')[0];
    var submitbtn = document.getElementsByClassName('myLink')[0]
    inputc.addEventListener("keydown", function(e){
      if(e.keyCode == 13){
        alert("Entered")
      }
    });
    submitbtn.addEventListener("click", function(e){
      // here I need functionality which will fire enter key event too
  
    });
  })();
  </code></pre>
  
  <p><a href="http://jsfiddle.net/pnq6xfwa/" rel="nofollow noreferrer">http://jsfiddle.net/pnq6xfwa/</a></p>