How to check if user pressed ENTER key while entering data into <input type=”text”> ?
Well, simply add an onKeyPress event:
<input type=”text” Â onkeypress=”return goReturn()”>
and use the following function:
function goReturn() {
    getEvent=event.keyCode;
    if (getEvent == “13″) {
   document.forms[0].submit();
   return false;
    } else {
   return true;
   }
}
this will submit the form when the return key is pressed (code 13)
Be First To Comment
Related Post
Leave Your Comments Below