title: Making Enter key (on keyboard) to submit the information --Jquery
body: <p>My Form looks like this:</p>
  
  <pre><code>&lt;body&gt;
  &lt;form id="myForm" method="post"&gt;
  &lt;label&gt;id:&lt;/label&gt; 
  &lt;input type="text" name="id" id="id" size="50"/&gt;
  &lt;div id="hidden" style="display: none;"&gt;
  &lt;label&gt;Name:&lt;/label&gt;
  &lt;input type="text" name="name" size="50"/&gt;&lt;br/&gt;
  &lt;input type="button" id="button2" value="Update" size="25" /&gt; &lt;br/&gt;
  &lt;/div&gt; 
  &lt;input type="button" id="button1" value ="Get Info" onclick="document.getElementById('hidden').style.display = ''; this.style.display = 'none'" size="25"/&gt;  
  </code></pre>
  
  <p>I have JS that looks like this</p>
  
  <pre><code>$(document).ready(function(){  
  $("#button1").click(function(){
      $.post(
          'xxx.php',
          { id: $('input[name="id"]', '#myForm').val() },
          function(json) { 
  
              if (json.abc === 'no'){
               alert('does not exist');   
              }
              else{
              $("input[name='name']").val(json.name);
              }},
          "json"
      );
  });
  
  $("#button2").click(function(){
      $('form#myForm').attr({action: "xxx1.php"});
      $('form#myForm').submit();
  });
  });
  </code></pre>
  
  <p>The problem is that the user can only submit this form by clicking on the submit button. Any ideas on how i can adjust the js so that the enter button(on keyboard) also submits the form?</p>
  
  <p><strong>Note</strong>: there are two submit buttons both are interlinked.</p>