I'm trying to remove an alert on a form when a user fixes an empty field. My generalized code works for all input elements where the user has to type in the field, but my input that has a popup calendar does not fire the "change" event if the date is placed in the field by the system. I thought the change event fired when the field lost its focus?
$("#my_input").change(function() {
$(".StatusBox").html("");
$(this).unbind("change");
});
I have another piece of code that runs after this and changes the input field(user clicking on a calendar date and therefore updating the input). Shouldn't that fire the change event?
Use something like this, it always works.
$(function() {
$("#my_input").on("change paste keyup", function() {
alert($(this).val());
});
});
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