I wanted to know how its possible to call a javascript function , as soon as one presses the “return(enter” key,just as in chat systems
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
this is then expandable to work for any number of key codes. You can also try the onKeyDown or onKeyUp events.
Remember to replace ENTER_KEY_CODE with the actual key code (32?). This should print out the keyCodes of any keys that are not enter so that you can figure out their keyCodes.
Edit:
[1] I forgot to mention you may want to detect the numpad-enter keycode.
[2] I forgot that onkeypress uses e.which to store the keyCode