I'm trying to prevent backspace from navigating back to the previous page with my code
$(document).keydown(function (e) {
if (e.keyCode === 8) {
alert("Backspace is pressed");
e.preventDefault;
return false;
} else {
}
});
It's working except when I focus on a select
tag then press backspace it ignores the function I created.