I have a text input field which i have made readonly so the user can't type into it. I update the value of it with jquery though. So basically I want an event to fire when its value gets changed using jQuery. Below is an example of the input markup and jquery markup.
<input type="text" readonly="readonly" id="textinput" />
$('#textinput').change(function() {
alert("It's Changed!");
});
You won't be able to do this. Changes made through code do not trigger events. You can simply call change
directly in your code.
Something like this:
// do stuff
$('#textinput').val("something").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