After some problems solved, I got a tricky stuff. I am using an overlay plugin for JQuery called prettyPhoto.
Just wanna make an overlay with a form. The form is hid
Using the solution proposed here I manage to make the datepicker appear/disapear in a lightbox (prettyphoto) BUT still with a javascript error (f is null) when selecting a date.
After couple of hours here's my complete solution :
$("#datepicker").live('focus', function(){
$(this).attr("id","datepickerNEWID");
$(this).datepicker();
});
Because lightbox creates a new DOM with a copy of the div content we then have 2 input with same ID that causes datepicker to not work so what I do is change the datepicker id.
Hope it helps!