About
Pricing
Community
Teams
Start Free Trial
Log in
Glen Gibb
asked on
9/1/2014
jquery - if ( keyCode == 13) allows all key values
Experts,
I'm trying to submit a form when the enter key is pressed. This code executes when ANY key is pressed!
function onKeyUp(e) {
if ( e.keyCode == 13)
$(this).closest('form').su
bmit();
}
I've also tried "code = (e.keyCode) ? e.keyCode : e.which;" to set the value. The keyCode value is fine.
But e.keyCode == 77 slips right through the filter!
Any ideas?
jQuery
2
1
Last Comment
Glen Gibb
8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
leakim971
9/1/2014
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Glen Gibb
9/1/2014
ASKER
Tnx for the speedy reply!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy