title: Detect type of submit, if it was by enter key or button click
body: <p>I have the following code:</p>
  <pre class="lang-html prettyprint-override"><code>    &lt;head&gt;
          &lt;script language=&quot;javascript&quot;&gt;
              function subimiti(event){
                  alert(&quot;Tipo do submit: &quot;+event);
              }
          &lt;/script&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id=&quot;f1&quot; name=&quot;form1&quot; onsubmit=&quot;subimiti(event)&quot; action=&quot;http://www.google.com&quot;&gt;
              &lt;input type=&quot;text&quot; id=&quot;meuId&quot; value=&quot;Teste&quot;/&gt;
              &lt;input id=&quot;butao&quot; type=&quot;submit&quot; value=&quot;Subimeta u fórmi trem bão!!&quot;/&gt;
          &lt;/form&gt;
  </code></pre>
  <p>In my JavaScript function I want to detect the event that causes the form submit. If it was by an enter key in my text field, or if it was by clicking on the button.</p>