Hi There
I've integrated a keyup event listener to listen for when the enter
key is pressed on certain elements, to submit a form, as I am using a
custom submit button (in the form of an anchor).
I'm using the following code:
$("#email, #password").keyup(function(e) {
if(e.keyCode == 13) {
$("#loginform").submit();
}
});
Fair enough, that works as expected. The only problem I have is when I
focus on the #email field, for example, my browser presents me with a
drop down list of previous entered email addresses, (form history).
When I use my arrow keys to scroll down the list to select my email,
and I hit enter, the form is posted. This behavior makes complete
sense, I was just wondering if anyone has any suggestions with regards
to a work around? (IE, when I hit enter on the selected email in the
form history drop down, I don't want the form to be posted, I just
wanted the selected email to populate the focused form input element.)