I have a form that contains the main data and the user can specify the category of this model by a dropdown field. When the user selects a type the type specific fields are loaded via ajax. This works pretty well but some of them have class="date" which should add the datepicker. Of cause I know that wont work as long as I call thedatepicker method again. So I do that again like this:
$(".date").datepicker({
dateFormat: 'dd.mm.yy'
});
But it doesnt work. This is the same code I use to apply the datepicker the first time but on the secound time nothing happens. Does anyone see a failure here?
// Specifying the fail: Its not like the datepickers are removed from the working fields but hey are simpley not applied to the fields that were loaded via ajax.
The datepicker has to be destroyed first in order to add a new one.
So try this: