You can associate the click event with the "Done" button in a previous datepicker callback like this ...
$( "#datepicker" ).datepicker({ showButtonPanel: true, beforeShow: function (input) { setTimeout(function () { var btn = $(input).datepicker("widget").find(".ui-datepicker-buttonpane .ui-datepicker-close"); btn.bind("click", function () { $(input).datepicker( "setDate", new Date() ); $(input).datepicker( "hide" ); }); }, 1); } });
This will work.
source share