I have a form on a web page that contains several textbox controls (i.e.
input type="text") and a checkbox. As soon as the text changes, in only a
subset of these textbox controls, I want to enable the checkbox. I've tried
the OnChange event for these textbox controls, but this event is fired only
when the control loses focus. I need the checkbox to enable immediately. I
then started experimenting with the OnKeyUp event for these controls, and it
works but it picks up many keystrokes that really don't matter (e.g. Tab,
Esc, Shift). In othe words, I am only concerned with keystrokes that can
actually change the text in the control.
I tried filtering by key code and only considering codes between 32 and 127,
inclusive, and 8 (for the back space key), but this still picks up keys like
the left arrow. In this case, the keycode appears to be 37 which is the %
character. I'm not sure why this is.
In any case, I don't have to take this OnKeyUp type of approach if someone
has a better technique. In the end, I just want to enable a checkbox as
soon as text starts to change in one of these controls. Any help on
accomplishing this would be greatly appreciated.
Thanks!