I want something to happen right after change has been made in input field, not after this input has been unfocused. Is there any alternative?
DEMO HERE
UPDATE it should be also working for types where user doesn't have to actually click the button in the keyboard (like HTML5 input types=number/date)
The actual event changes with the type of the control. I put together some examples:
$(document).ready(function() {
function callback() { alert($(this).val()); }
$('input[type=number]').on('input',callback);
$('input[type=date]').on('input',callback);
$('input[type=text]').on('keyup',callback);
});
NOTE: If you use CTRL+V to paste text, the keyup
event might fire twice.
NOTE2: Right click -> Paste won't be recognized. paste
event won't help you either, because it fires before the text is updated.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With