Use $.on()
to bind your chosen event to the input, don't use the shortcuts like $.keydown()
etc because as of jQuery 1.7 $.on()
is the preferred method to attach event handlers (see here: http://api.jquery.com/on/ and http://api.jquery.com/bind/).
$.keydown()
is just a shortcut to $.bind('keydown')
, and $.bind()
is what $.on()
replaces (among others).
To answer your question, as far as I'm aware, unless you need to fire an event on keydown
specifically, the change
event should do the trick for you.
$('element').on('change', function(){
console.log('change');
});
To respond to the below comment, the javascript change
event is documented here: https://developer.mozilla.org/en-US/docs/Web/Events/change
And here is a working example of the change
event working on an input element, using jQuery: http://jsfiddle.net/p1m4xh08/