I have a page with a number of date picker fields, but I can also add additional fields inline. I am using jQuery UI to use these fields as date picker. Everything works perfectly expect when I start adding more fields inline; the date pickers don’t work in the new fields.
Further check revealed that if I add the new fields then start clicking in the fields to load the calendar, it works; for all new and existing!, but if I click on any of the already available fields (to load the calendar) then add more fields and try to click in those new, it won’t load in the new ones!
I am using .live() for the event which is supposed to deal with events and inline added content. But I’m still stuck.
My function:
$("input[id^='calendar']").live('click', function() {
$(this).datepicker({dateFormat: 'dd MM, yy', showWeek: true}).focus();
}).focus();
I’ve tried adding datepicker(‘destroy’), but still doesn’t work.
Any thoughts?
Thank you