I have a button in my html page
<input id=btnLogin class=loginBtn type=button value=Login title=Login />
I have binded a jquery click event to this button like
$('#btnLogin').click(function () {
ValidateLogin();
});
I'm also checking the enter key press to call the same function ValidateLogin();
like below
$(document).keypress(function (e) {
if (e.which == 13) {
ValidateLogin();
}
});
The issue that i'm facing is when the user presses the tab key
to get in focus over the Login
button and then press Enter Key
the ValidateLogin()
is called twice.How to deal with this situation.
Note : i can't use type=submit to do a form submit ..since i'm using ajax call on button click