The onchange event for a HTML input box does not fire until the textbox loses focus. Is there a way to make it fire as soon as the contents change?
Here’s an example of onchange firing after focus loss: http://jsfiddle.net/McjqW/
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.
You are looking for the
onkeypressoronkeydownevent. Note that this event is not standard, and different browsers may expose this functionality under different names. The DOM level 3 standard defines akeypressevent which would be “the” answer, but again I can’t vouch for browser support.Update:
onkeypressreportedly enjoys wide support.