First off, I know this has been asked before. I'm asking again in the hopes that more recent versions of common libraries like jQuery have solved this. This may be wishful thinking, I know...
Having said that, is there a way to detect all changes (keypress, paste, autocorrect) to an <input>
yet? I was using $("#myElement").bind('input propertychange', function (e) {...});
until IE9 came along and broke it (it doesn't fire on backspace/cut/delete).
There are three options that I'm aware of, all of which have drawbacks:
- Bind to even more events (keyup, paste, etc.) and use
setTimeout
to ignore duplicates. - Bind to specific events based on browser detection.
- Bind to even more events, track the old value with jQuery.data(), and compare against it before firing the handler (as in this answer).
If there's not a "better way" yet, which of the above do you prefer, and why?