Skip to content Skip to sidebar Skip to footer

Dynamic Jquery Ui Datepicker Elements

I am using the jQuery UI datepicker function to create a number of date fields in my html form. I am using the following code to get any input field with a 'datepicker' class to wo

Solution 1:

As you are probably calling that iteration on document creation, items added to the DOM later are not instantiated as new datepickers, so you would have to explicitly call .datepicker() on each of the newly added elements you wish to enable datepicker on.

Basically, move the code from the iterator above to its own function, then do:

$('.datepicker').each(myDatePickerFunction($(this));

And call the same function on the elements you add later.

Post a Comment for "Dynamic Jquery Ui Datepicker Elements"