hi all, i was wondering what may be the best solution to detect a change in value of an input box. Right now im currently using onKeyUp, which is having various problems. firstly, it appears “laggy” because the event only fires when the key goes Up. secondly, if someone were to right-click paste, it would seriously break my script.


doesn’t onchange activates when the “focus” of the textbox changes?

I can’t remember. what happened when you tried it?

No, onchange only triggers when the content changes. So if you tab in to the field, write some stuff, then click or tab out, the onchange event only triggers when you leave the field.

Perhaps you’re looking for the onkeypress event instead, if you’re wanting to capture each individual keystroke?

however the problem i face with onkeypress is that if the user rightclick-paste, my script wouldn’t detect it, is there a solution?

Not really, no. There’s only a limited amount of control that you can have over your user.

as in a “fix”, the current solution i can think of is to put the same logic in onclick as well