$(el).bind('blur keypress', function(event){
if(event.type == 'keypress' && event.keyCode != 13) return;
alert(1);
});
I get the alert box even when I press escape, and I shouldn;t because I only allowed Enter…
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
By default “return” will send the called function the value true, so in this case the default event is allowed to be performed so whatever button u press u will get the alert. So change the return statement as return false