Form submit on keyCode == "enter" (13)
<p>I need to submit the content of a form when I press the Enter key, but only if the form has no error message. I build 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 error_m
 the rest is simple code condtion but it doesn't work?</p>

<p>Need some help with this!!</p>
