Thomas Stock
Thomas Stock

Reputation: 11266

Add eventhandler to jQuery UI datepicker after its creation

I have the following scenario:

In my masterpage I have:

$(".datepicker").datepicker({
    changeYear: true,
    changeMonth: true,
    dateFormat: "dd/mm/yy",
    duration: 'fast'
});

With this, every input field that I assign the class "datepicker" to, shows the jQuery UI datepicker when clicked.

Now I have a datepicker on a page that should have its onSelect event handled. What would be the way considered best practise to do this?

Options I see:

Upvotes: 13

Views: 8304

Answers (1)

kgiannakakis
kgiannakakis

Reputation: 104188

Have you tried:

$(".datepickerSelect").datepicker( 'option' , 'onSelect', function() {} );

Upvotes: 36

Related Questions