im using the Datepicker that comes with jquery...
new.php
<html>
<table id="testtable">
<tr id="table_row1">
<td><input type="text" name="date[]" class="pickDate"></td>
<td><?php ...some php stuff here...?> </td>
</tr>
</table>
<label onclick="cloneRow('testtable','table_row1')"></label>
</html>
index.php
<html>
<php
include('new.php')
?>
<script>
$(document).ready(function() {
$('.pickDate').each(function() {
$(this).datepicker({ dateFormat: 'dd.mm.yy' });
});
});
</script>
</html>
javascript function for cloning:
function cloneRow(tablename,rowname) {
var row = document.getElementById(rowname); // find row to copy
var table = document.getElementById(tablename); // find table to append to
var clone = row.cloneNode(true); // copy children too
clone.id = "newID"; // change id or other attributes/contents
table.appendChild(clone); // add new row to end of table
}
So the problem is, on the first row, the datepicker is there, and works, but if i clone the row, the cloned one has no datepicker.
I checked if the class gets cloned too, and yes it does.
Im very new to jquery, but does jquery maybe not notice that there has been added a new row?
How can i get this to work?