Reputation: 9580
Every time enter is pressed the entire page refreshes on the iPad, I want to prevent this from happening. I have tried every example I have seen and it is not working the ipad.
$('#<%= txtEmail.ClientID %>').keyup(function (e) {
if (e.which === 13) {
alert('enter was pressed');
e.preventDefault();
return false;
}
});
The alert is working but the page is refreshing everytime, any ideas what to change to make this code work on ipad?
Upvotes: 0
Views: 120
Reputation: 665545
I'd guess the keypress
event causes the form to submit, you'd need to prevent that. However, it might be more straightforward to prevent the submit
event instead of dealing with the confusing key events (see also Detecting keystrokes).
Upvotes: 1