I have a PHP For that loads 5 times the same set of input fields for multiple entries.
At the same time, I have a "datepicker" javascript to be run in the date field.
The issue is that only in the first row the datepicker is working. For the next 4 rows loaded, the datepicker doesn't run in the date field.
Code:
<?php
for ($i=0;$i<5;$i++)
{
?>
<tr>
<td><input id="includeItem" type="checkbox" onchange="includeMore" name="item<?=$i?>"></td>
<td><input name="id<?=$i?> style="color:#888;" disabled="disabled"></td>
<td><input class="formItems" id="datepicker" name="date<?=$i?>"></td>
<td><input class="formItems" name="description<?=$i?>"></td>
<td><input class="formItems" name="amount<?=$i?>"></td>
</tr>
<?php } ?>
Javascript:
<script>
$(document).ready(function() {
$("#datepicker").datepicker({
dateFormat: 'yy-mm-dd'
});
});
</script>