I have a button submit like this :
<input type="button" id="button_sign_in" class="button_sign_in" value="Sign in"/>
and I have jQuery submit like this :
$(document).ready(function()
{
$('#button_sign_in').click(function(){
console.log('login');
$.ajax
({
url: "login",
type: "post",
data: $('#login_form').serialize(),
dataType:'json',
success: function (data)
{
if (data.status=='SUCCESS')
{
window.location='home.php';
}
else
{
$('#button_sign_in').shake(4,6,700,'#CC2222');
$('#username').focus();
}
},
error: function (e) {
console.log('error:'+e);
}
});
});
});
The problem is : we can't submit using enter key, so user must click the button Sign in to submit.
What I want ? set enter key into JS function, so user can choose submit using enter key or click the button Sign in.
Thanks for any help.