Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

Q1785 How do I prevent a form from being submitted when I press the ENTER key?

You are here: irt.org | FAQ | JavaScript | Form | 7.1 | Q1785 [ previous next ]

Add the following to your form.

<script>
function stopEnter() {
  if (event.keyCode == 13) event.returnValue = false;
}
</script>

<input type="text" name="MYFIELDNAME" size="5" onKeypress="stopEnter()">

Submitted by Damir

Feedback on 'Q1785 How do I prevent a form from being submitted when I press the ENTER key?'

©2018 Martin Webb