HTML5 oninput
polyfill as a jQuery plugin
<input>
<textarea></textarea>
$('input, textarea').input(function(event) {
// `this` is the DOM element
// `event` is the jQuery event object
alert(this.value);
event.preventDefault();
});
- Works in all A-grade browsers, including IE6. In case
oninput
is not supported,onkeydown
is used instead. - This plugin doesn’t support event delegation.
This plugin is dual licensed under the MIT and GPL licenses, just like jQuery itself.