I want my jQuery datepicker (jQuery UI 1.8.13) to generate a report only when I click the ‘Done’ button.

The onClose event is not good because that is triggered also when I click somewhere else (not in the datepicker) and I need to generate the report only when the ‘Done’ button is pressed. Therefore I need to add an onclick callback to the ‘Done’ button. However I can not find a jQuery selector that will match the ‘Done’ button. I have tried the $('.ui-corner-all') but that will also find other elements too.
So, I have tried $('.ui-priority-primary') (because AFAIK this is the only element that has this style), but it does not match the button …
- I need a selector that will only match that ‘Done’ button.
- Why is
$('.ui-priority-primary')not working?
Please find the sample code here.
UPDATE I use a this datepicker as a monthpicker, so I do not have dates to click on. Therefore it is important that I need to put the callback on the ‘Done’ button as I have stated above.
As far as it not working, this is because the control is created after your binding takes place. If you use delegate then it will work. Although I think Darin’s answer is probably a better solution, I am providing this as it directly answers the ‘why’ of your question.
http://jsfiddle.net/7ThB8/30/