Link to home
Start Free TrialLog in
Avatar of tr5
tr5

asked on

onchange event for input text element not firing when changing value

I have a an input element:
<INPUT size=1 TYPE="TEXT" name="no_cat_input" value="0" onChange="calcCats();">

According to what I read about JS events, the function calcCats() should run when i change the text in the field. however it only runs when I change the value AND then click elsewhere to get the focus off the input element. Why is this?

thanks
tr5
ASKER CERTIFIED SOLUTION
Avatar of neeraj523
neeraj523
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Because the onChange event fires when you actually made a change to the text box, which happens after the text box loses focus.

neeraj523's answer should work for your case, using onKeyUp or even onKeyDown event.
Dear @tr5

do you need any further assistance on your this question ?
Avatar of tr5
tr5

ASKER

Thank you.