Datepicker does not fire input "input" event
For Datepicker, when a date is selected and the associated input's value is updated, the "change" event is fired, but the "input" event is not. I assume this is because Datepicker was originally created before the "input" event became standard.
Although this has been the longtime behavior, it looks to be a simple change to fire the "input" event at the same time.
https://github.com/jquery/jquery-ui/blob/e21a2543b55680f23aaa7efa38f3288b8e767e7d/ui/widgets/datepicker.js#L1111-L1113
Thanks for the report. Since the issue is already in 1.12, given limited team resources it's not likely to be fixed by the UI team; see the project status at https://blog.jqueryui.com/2021/10/jquery-maintainers-update-and-transition-jquery-ui-as-part-of-overall-modernization-efforts/. PRs are welcome if they're not too complex.
Don't use the change event, use the input event. Which one you use it doesn't matter they won't fire. The problem is that the input event is not being dispatched! You have to manually dispatch the event like this:
$( "#inputStartDate" ).datepicker({
showOn: "button",
buttonImage: "https://stealth-apsvaw.streamhoster.com/aetv_dashboard_hd/icons/calendar_20.png",
buttonImageOnly: true,
dateFormat: "mm/dd/yy",
changeMonth: true,
changeYear: true,
minDate: 0,
onSelect: function(dateText) {
var inputEvent = new Event('input', {
bubbles: true
});
document.getElementById("inputStartDate").dispatchEvent(inputEvent);
}
});
document.getElementById("inputStartDate").addEventListener('input', function (event) {
alert('date changed');
});