jQuery submit() not working
<p>I have a handler to catch the event of an "enter" inside a set of inputs in the context of an authentication function, but it's not working when I press the key. The code is as follows :</p>

<pre><code>$('#login form').submit(function(e) { login(e); });

function login(e)
{
    e.preventDefault();

    var l = $('#logo a').attr('href');
    var name = $('#login input[name="login_username"]').val();
    var pass = $('#login input[name="login_password"]').val();

    $.ajax({
        type: 'POST',
        url: l+'user/login',
        data: 'username='+name+'&amp;password='+pass,
        cache: false,
        dataType: 'json',
        success: function(response)
        {
            if (response.status == true)
                window.location = response.redirect;
            else
                jQuery.facebox('&lt;p class="facebox-notice"&gt;'+response.error+'&lt;/p&gt;');
        }
    });
}
</code></pre>

<p>It does work, however, to the button I have for the same purpose :</p>

<pre><code>$('#dologin').click(function(e) { login(e); });
</code></pre>

<p>Any ideas why? Cheers!</p>

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

<p>The markup is as follows :</p>

<pre><code>&lt;div id="login"&gt;
  &lt;form action="" method="post"&gt;
    &lt;input type="text" name="login_username" /&gt;
    &lt;input type="password" name="login_password" /&gt;
    &lt;a href="" id="dologin"&gt;LOGIN&lt;/a&gt;
  &lt;/form&gt;
&lt;/div&gt;
</code></pre>
