Cool Code - Javascript - Replace Enter with Tab

This code only works for IE because the event.keyCode is read-only in Mozilla and most other browsers. This simple snippet will keep the ENTER key from submitting the form in the IE browser. If you want something that will work in IE as well as other browsers that will take a lot more code and adding an event to each object on the page for the most part. If you are looking for something like that, take a look here.

//————————————
//replaces the enter key with the tab key

document.onkeydown = function
() {   if (event.keyCode == 13)
   {
      event.keyCode = 9;
   }
}
//————————————-

Leave a Reply