Search and Top Navigation
#7688 closed bug (notabug)
Opened September 02, 2011 02:37PM UTC
Closed September 03, 2011 12:21PM UTC
Datepicker events can't be bound
Reported by: | be.davestein | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 1.9.0 |
Component: | ui.datepicker | Version: | 1.8.16 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I saw a few bugs in regards to events not being fired when switching between pickers, but nothing like this so I don't think I'm submitting a duplicate.
Anyway I just did a long overdue upgrade of jquery from 1.4.2 and 1.8.11 to the latest of both. Now my old code of $('#el').bind('onSelect', function() { ... }) doesn't work.
Attachments (0)
Change History (1)
Changed September 03, 2011 12:21PM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
As documented (see http://docs.jquery.com/UI/Datepicker#event-onSelect ) the Datepicker's onSelect event can only be handled by setting the onSelect option to a callback function. Most Datepicker events don't support binding through .bind() as do all the other widgets. Compare to something like http://docs.jquery.com/UI/Accordion#event-change. The exception is the one event provided by the widget factory, create http://docs.jquery.com/UI/Datepicker#event-create. The reason for this is that historically Datepicker wasn't build on top of the widget factory. It has been refactored to use some of the widget factory but not all of it. This will be supported by a complete rewrite of the Datepicker, which is underway ( see #6737 and #6228 ). The existing code is only being modified to address critical issues and regressions.
Your comment
Anyway I just did a long overdue upgrade of jquery from 1.4.2 and 1.8.11 to the latest of both. Now my old code of $('#el').bind('onSelect', function() { ... }) doesn't work.
seems to suggest you find this behavior a regression since jQuery 1.4.2 and jQuery UI 1.8.11 but the behavior is the same with those versions. See http://jsfiddle.net/x2LFH/4/