Sheils
asked on
How to use datepicker with dynamic table
I am trying to use jQuery datepicker with a dynamic table. The problem I am having is that the date picker keep changing the date in the first row. The codes I am currently using is as follows:-
So what do I need to do to insert the date into the new row.
Thanks
<script>
$( document ).ready(function() {
$(function()
{
$(".datepicker").datepicker({dateFormat: "dd M yy", changeMonth: true, changeYear: true,Anim:"Clip"});
$(".datepicker").attr('readOnly', 'true');
}
);
$(".button").click(function() {
var $currentrow= $(this).closest('tr');
$(".datepicker").datepicker("destroy")
var $newrow=$currentrow.clone(true);
$newrow.find('input:text').val('');
$newrow.find(".datepicker").datepicker({dateFormat: "dd M yy", changeMonth: true, changeYear: true,Anim:"Clip"});
$newrow.appendTo('tbody');
})
});
</script>
So what do I need to do to insert the date into the new row.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER