I have an input field and a login button. I want to allow users to hit the \"enter\" key to click the button when the input field is focused. How would I do this with jQuery?<
$('#loginUserID').keypress(function(event){ if(event.keyCode == 13){ $('#loginBtn').click(); } });
Demo: http://jsfiddle.net/Bhf5a/