Is there any way to handle the event of pressing the "done" button in jquery UI DatePicker?
I have a datepicker that allows only to choose between year and month as in here
The problem is that using the onclose event prevents me from clearing the field (if I click the datepicker pops up then if I close the current selected month and year are put into the field).
I would like not to use an additional "clear" button outside the datepicker, so I though I could use the Done button.
I found solution on one forum (can't remember where - sorry). I know it's been a while, but for future search :)
Note: The change needs to be done in the plugin. You can simply search for "onClose:" to find it.
onClose: function (dateText, inst) {
function isDonePressed() {
return ($('#ui-datepicker-div').html().indexOf('ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all ui-state-hover') > -1);
}
if (isDonePressed()){
alert('done pressed');
}
}
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