I am trying to create a form in which elements are added dynamically by cloning existing elements in the form. Now the problem i am facing is when i cloned textbox which has class "datepicker".When I select the date from cloned element it's selected value shows in the first element from which I cloned it.
Here is the code:
$(copiedDiv).find('input[type="text"]').filter('.datepicker').removeClass('hasDatepicker').datepicker();
and in document.ready I tried this:
$(function () {
$(".datepicker").datepicker();
});
and this:
$(function () {
$(".datepicker").each(function(){$(this).datepicker()});
});
but both gives the same result. Plz guide me. . Thanx