There is one and only one reliable way to do this, and it is by pulling the value in an interval and comparing it to a cached value.
The reason why this is the only way is because there are multiple ways to change an input field using various inputs (keyboard, mouse, paste, browser history, voiceinput etc.) and you can never detect all of them using standard events in a cross-browser environment.
Luckily, thanks to the event infrastructure in jQuery, it’s quite easy to add your own inputchange event. I did so here:
$.event.special.inputchange = { setup: function() { var self = this, val; $.data(this, 'timer', window.setInterval(function() { val = self.value; if ( $.data( self, 'cache') != val ) { $.data( self, 'cache', val ); $( self ).trigger( 'inputchange' ); } }, 20)); }, teardown: function() { window.clearInterval( $.data(this, 'timer') ); }, add: function() { $.data(this, 'cache', this.value); } };
Use it like: $('input').on('inputchange', function() { console.log(this.value) });
There is a demo here: http://jsfiddle.net/LGAWY/
If you’re scared of multiple intervals, you can bind/unbind this event on focus
/blur
.