OnSelect datepicker not working I am having a problem with this function, it simply is now working. I have a module with just a basic form and im using the date module to get the datepicker to pop up and that works fine, but when I select a date from the datepicker the alert is not firing.

this is what i have in my theme js file. 

//id for nay_date input field     
$('#edit-nay-date-datepicker-popup-0').datepicker(function() {
              onSelect: function(selectedDate) {
              alert(selectedDate);
            }
        });


and this is the field i have in my module

$form[['nay_date'] = array(
    '#title' =&gt; 'Date',
    '#type' =&gt; 'date_popup',
    '#description' =&gt; '',
    '#required' =&gt; TRUE,    
);
I use it without a function as the argument like: jsfiddle

//id for nay_date input field     
$('#edit-nay-date-datepicker-popup-0').datepicker({
          onSelect: function(selectedDate) {
          alert(selectedDate);
        }
    });