More information about the Underscore mailing list

[_] Javascript: detecting a text box value change via cut and paste

Tim Beadle tim.beadle at gmail.com
Tue Feb 26 15:54:51 GMT 2008

I've found a nice solution to the problem of filtering the contents of
a select box:
http://www.barelyfitz.com/projects/filterlist/

I've attached it to the onkeyup event of an associated text input,
which is fine when you're using the keyboard. When a user uses the
mouse to Copy / right-click / Paste into the text input, the onkeyup
event doesn't fire, obviously.

There's this nice TypeWatch plugin for jQuery (which I'm coding on):
http://plugins.jquery.com/project/TypeWatch

It detects when a user has stopped typing and calls a function
thereafter, but still doesn't work if the mouse is used exclusively
for input, as in the right-click / Paste example, as they never
started typing in the first place.

So, bearing in mind that the onchange event doesn't fire until the
input loses focus, what's a guy to do?

Halp!

Tim