When set value of input in JavaScript which event raised?
I tried these event: (propertychange
change
keypress
paste
focus
textInput
input
keyup
keydown
change
).
For example:
$('input').live/bind/on('which event', function() {
//...
});
$('input')[0].value = "sd";
When you set the value programmatically no event will be raised. You can raise it yourself though:
$('input')[0].value = "sd";
$('input').first().trigger("change");
Or just using jQuery:
$('input').first().val("sd").trigger("change");
You can do something like this. You have to explicitly call change
event.
$('input').val('New Value').change();
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