jquery - "click" on keypress?
- by WonderBugger
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();
}
});
}