0

I have a "login form" that "onkeyup" checks the form and does as asked but I want to disable the enter key entirely so that pressing it has no effect on the form. This is because if I wanted the key to be : "apple" some fast typing users will press enter before the javascript has run for the "checkform". This results in ?userid="apple" in the url and the page refreshing and I dont want that to happen. Any help here?

login form:

<input type="text" style="background-color: black; border-color: black; color: white; width:100%; height:100%; font-family: VT323; font-size: 3EM; " placeholder="my house color" name="userid" onchange="javascript:this.value = this.value.toUpperCase();" autocomplete="off" onkeyup="check(this.form)"/> <br>

current enter key disabler (not working)

$('form input').on('keypress', function(e) {
    return e.which !== 13;
});
mr. pc_coder
  • 16,412
  • 3
  • 32
  • 54
  • 1
    Does this answer your question? [Prevent users from submitting a form by hitting Enter](https://stackoverflow.com/questions/895171/prevent-users-from-submitting-a-form-by-hitting-enter) – db1975 May 08 '20 at 20:32
  • No, It still enables the enter button to be recognized –  May 08 '20 at 22:19

0 Answers0