You're looking for the html5 input
event:
$(…).on("input", function(e) {…});
However, it doesn't work in older browsers. You can hook on multiple events (most relevant keyup
), and fire your listener on each of them. If you're doing rather heavy computations, you should filter to those events only that led to an actual change:
var val;
$(…).on("input change keyup keypress cut paste mouseup focus blur", function(e) {
if (this.value !== val)
val = this.value;
…
}
});