title: Form submit on keyCode == "enter" (13)
body: <p>I need to submit the content of a form when I press the <kbd>Enter</kbd> key, but only if the form has no error message. I built up the following function:</p>
  
  <pre><code>$(targetFormID).submit(function (e) {
      var mess = error_m(targetDiv);
      if (e.keyCode == 13 &amp;&amp; mess.length &gt; 0) {
          e.preventDefault();
          e.stopPropagation();
      }
      if (mess.length == 0 &amp;&amp; e.keyCode == 13) $(targetFormID).submit();
  }); 
  </code></pre>
  
  <p>In this function the mess variable is getting the error message returned by function <code>error_m</code>, the rest is simple code condtion but it doesn't work.</p>
  
  <p>Need some help with this!!</p>