jquery - "click" on keypress?
Posted
by
WonderBugger
on Stack Overflow
See other posts from Stack Overflow
or by WonderBugger
Published on 2010-12-31T22:57:24Z
Indexed on
2010/12/31
23:54 UTC
Read the original article
Hit count: 187
I have an ajax search form that works fine if you click "submit" in that you enter a zipcode, click the "Enter" button and up pops results instantly. I'm trying to make it so that if the user presses "enter" on the keyboard, it has the same effect. It looks like it's submitting, but no results come up...
I tried:
if($('#search').length) {
$('#zipcode').keyup(function(e) {
if(e.keyCode == 13) {
e.preventDefault();
$('#search').submit();
}
});
}
© Stack Overflow or respective owner