I'm using jQuery datepicker, and I'm using this code ...
<script>
$(function() {
$("#datepicker").datepicker();
//$("#datepicker2").datepicker();
});
</script>
...at the header of my page. Meanwhile, with PHP, I want to call it an indefinite number of times.
But I can't use this function to place "datepicker" more that once if there is only one: $("#datepicker").datepicker(); on the function.
How can I call this function an indefinite number of times?
call a class ..
$(".datepicker").datepicker();
and you can call indefinite number of time ..just that all your input should have the class datepicker
example
<input name="test1" class="datepicker" />
<input name="test2" class="datepicker" />
.......
IDs are meant to be unique.
Switch your #datepicker for .datepicker on your html and on your jQuery.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With