title: How to keep focus in input element where Enter was pressed to submit form
body: <p>Form contains input elements and submit button. Pressing Submit button shows pdf file in new tab in browser.
  If enter is pressed to show report, focus moves to submit button. After selection report parameters tag again additional click in input element is required to enter new value to same element.</p>
  
  <p>How to keep focus input element where enter was pressed ?</p>
  
  <pre><code>&lt;form id="Form" class='form-fields' method='post' target='_blank'
  action='Render'&gt;
  
  &lt;input id='test' name='test' value='test' /&gt; 
  ...
    &lt;input id='_submit' type='submit' value='Show report' /&gt; 
  &lt;/form&gt;
  </code></pre>
  
  <p>jquery, jqueryui, asp.net mvc2 are used.</p>
  
  <p><strong>update</strong></p>
  
  <p>I have 2 elements with same name in form to allow unchecked checkbox submission:</p>
  
  <pre><code>&lt;input type='hidden' value='false' name='Summary' /&gt;
  &lt;input type='checkbox' id='Summary' name='Summary' checked /&gt;
  &lt;select class="ui-widget-content ui-corner-all" id="_Report" name="_Report" size="10"&gt;
  &lt;option value="LV001"&gt;Report1&lt;/option&gt;
  &lt;option value="LV003"&gt;Report2&lt;/option&gt;
  &lt;option selected="selected" value="LV009"&gt;Report3&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>I tried code below as suggested in comment. If focus is in checkbox, it focus is not restored. Instead select element is focused. How to fix ?</p>
  
  <pre><code>        $("#Form input:not([type=submit]), textarea, select").focus(function () {
              $('input').removeClass('hasFocus');
              $(this).addClass('hasFocus');
          });
  </code></pre>