Posted By

hotdiggity on 04/30/09


Tagged

forms


Versions (?)

Prevents the return key from submitting the form.


 / Published in: JavaScript
 

URL: http://www.mediacollege.com/internet/javascript/form/disable-return.html

  1. <script language="javascript" type="text/javascript">
  2. function stopRKey(evt) {
  3. var evt = (evt) ? evt : ((event) ? event : null);
  4. var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
  5. if ((evt.keyCode == 13) && (node.type=="text")) { return false; }
  6. }
  7. document.onkeypress = stopRKey;
  8. </script>

Report this snippet  

You need to login to post a comment.