When adding new content to a page client side using jQuery by cloning
an existing item, like a textbox, and adding the datepicker to it
sounds real easy, and it is:
var $existing = $('somecontentwithdatepicker').clone(); (did not use
clone(true) since don't want all the events)
$existing.datepicker().insertAfter('someother');

However this will not work! You ALSO need to remove the class
"hasDatepicker" from the cloned item since the datepicker adds it when
it has set it. So to make sure, and don't try and use "removeClass
('hasDatepicker')" as it also does not work:

var datePick = /hasDatepicker/g;
var $lastLine = $('mynewline:last').html();
$lastLine = $lastLine.replace(datePick,'');
$('mynewline:last').empty().html($lastLine).datepicker();

Done, works like a charm.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to