title: How to invoke a p:commandButton by JavaScript on enter keypress?
body: <p>I have write a  and a  in my page.
  When enter key was pressed ,I want to do any js check, if success post an action.</p>
  
  <p>Javascript：</p>
  
  <pre><code>function text_onkeypress() {
      if(event.keyCode==13){
          formSubmit();
      }
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;p:inputText id="context" value="#{bean.fileName}"
   onkeydown="text_onkeypress();"&gt;&lt;/p:inputText&gt;
  &lt;p:commandButton id="search" value="submit" onclick="return formSubmit();" 
   action="#{action.getResult}" &gt;&lt;/p:commandButton&gt;
  </code></pre>
  
  <p>when I write query("#search")[0].click() in the javascript.It can do the check, but can't do action="#{action.getResult}".</p>
  
  <p>I don't know how to do the losted action.</p>