Reputation: 1640
Hi i'm currentyl having an issue with a form on a website, im using a link instead of a button or an input to submit a form, but i cannot seem to make it submit when the user press the enter key, the Form values are being validated using javascript with the following format onsubmit="return function();"
Anybody knows how to make it submit on enter keypress ?
Thanks
Upvotes: 2
Views: 1973
Reputation: 679
Try capturing the event.keyCode property when hitting a key on the particular link.
$('#example').keyup(function(event) {
if(event.keyCode === 13) {
//do what you want
**EDIT:** $('$FormName').submit();
}
});
Upvotes: 3