Why this submit all form code isn't working?
<p>The code below is colouring the input but not submitting the form in chrome. It's working in Firefox:</p>

<pre><code>    &lt;script type="text/javascript"&gt;
    $(function(){
    $('input').keypress(function(event) {
    if (event.keyCode == '13') {
    //alert($(this).parentsUntil('form').css('color'));
    $('form').css('color','red');
    $('form').submit();
    }
    });});&lt;/script&gt;
</code></pre>

<p>Please note that the submit button is set to display:none, if I change it to visibility:hidden, it works but it reserve the place which is not what I want.</p>

<p>Thanks.</p>

<p><strong>EDIT</strong></p>

<p>Here's a full example as requested below:</p>

<pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&gt; 
&lt;head&gt; 
&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; 
&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"&gt;&lt;/script&gt; 
&lt;title&gt;دخول&lt;/title&gt; 
&lt;script type="text/javascript"&gt; 
$(function(){
    $('input').keypress(function(event) {
        if (event.keyCode == 13) {
            $(this).parents('form').submit();
        }
    });
});
&lt;/script&gt; 
&lt;/head&gt; 
&lt;body&gt; 
&lt;form action="http://www.yahoo.com" method='post'&gt; 
&lt;table &gt; 
&lt;tr&gt;&lt;td&gt;name: &lt;/td&gt;&lt;td&gt;&lt;input type="text" name="username" value=""&gt;&lt;/td&gt;&lt;/tr&gt; 

&lt;tr&gt;&lt;td&gt;password: &lt;/td&gt;&lt;td&gt;&lt;input type="password" name="password" value=""&gt;&lt;/td&gt;&lt;/tr&gt; 
&lt;tr&gt;&lt;td colspan=2&gt;&lt;a href="javascript:void(0)" onclick="$('#loginfrm').click();"&gt;Login&lt;/a&gt; 
&lt;div style="display: none;"&gt;&lt;input type="submit" name="submit" value="Login" id="loginfrm"&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt; 
&lt;/table&gt; 
&lt;/form&gt; 
</code></pre>
