I am using Date popup module for selecting a date in a registration form. Is it possible to fire an event on date select?
-
What kind of an event? Do you want to trigger an ajax form event or a custom JS/jQuery event?– Suranga Panagamuwa GamageCommented May 22, 2015 at 9:42
-
1Drupal's Date module uses a jQuery UI Datepicker, see the doc for the select event– BenCommented May 22, 2015 at 9:44
-
A custom function.– AnamikaCommented May 25, 2015 at 11:24
Add a comment
|
1 Answer
For Drupal 7, the datepicker is indeed likely to be the one from jQuery UI, and since you may not know in your own javascript if date pickers have been initialized yet, an easy way to trigger your "custom function" is to listen for selection on any date picker on the page.
jQuery.datepicker.setDefaults({
onSelect: function () {
console.log('date selected');
}
});
Refer to the jQuery UI onSelect documentation for more information.