I've got a tutorial based web page, where users can advance to the next tutorial page by using arrow href buttons (only if they complete some tasks). Also on most pages the enter key will advance you to the next page.
However, some tutorial pages, use the enter key for different purpose, and i want that key to be disabled. I've done the following:
$(window).keyup(function(e) {
if (e.keyCode == 13)
{
e.preventDefault();
return false;
}
});
which works fine in IE/FF/Opera but it doesnt in chrome.
In chrome, if i add an alert inside if, then the form will not submit. otherwise it will.
Any idea?
$(function () {
$('form').bind("keypress", function (e) {
if (e.keyCode == 13) return false;
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With