I'm tyring to implement this calendar for my project. http://eonasdan.github.io/bootstrap-datetimepicker/
The problem is that I need to use the same calendar with the id (i.e #datetimepicker8 and #datetimepicker9) for five times.
In other words, I'm trying to run a for loop five times, that will display the calendar five times (with from and to date).
To make this shorten, I have five rows(running in for loop) with From and To date and the user will select the From Date and To Date.
Here is my full code: http://pastebin.com/80p18JXQ
<script type="text/javascript">
$(function () {
$('#datetimepicker8').datetimepicker();
$('#datetimepicker9').datetimepicker();
$("#datetimepicker8").on("dp.change",function (e) {
$('#datetimepicker9').data("DateTimePicker").setMinDate(e.date);
});
$("#datetimepicker9").on("dp.change",function (e) {
$('#datetimepicker8').data("DateTimePicker").setMaxDate(e.date);
});
});
</script>
<table>
<tr><td>
<div class="col-sm-3">
<div class="input-group date" id="datetimepicker8" style="width: 150px;" tabindex="2">
<input class="form-control" name="from_date" type="text">
<span class="input-group-addon"><i class="glyphicon-calendar glyphicon"></i></span></div>
</div></td>
<td>
<div class="col-sm-3">
<div class="input-group date" id="datetimepicker9" style="width: 150px;" tabindex="2">
<input class="form-control" name="to_date" type="text">
<span class="input-group-addon"><i class="glyphicon-calendar glyphicon"></i> </span> </div>
</div></td></tr>
<tr><td>
<div class="col-sm-3">
<div class="input-group date" id="datetimepicker8" style="width: 150px;" tabindex="2">
<input class="form-control" name="from_date" type="text">
<span class="input-group-addon"><i class="glyphicon-calendar glyphicon"></i></span></div>
</div></td>
<td>
<div class="col-sm-3">
<div class="input-group date" id="datetimepicker9" style="width: 150px;" tabindex="2">
<input class="form-control" name="to_date" type="text">
<span class="input-group-addon"><i class="glyphicon-calendar glyphicon"></i> </span> </div>
</div></td></tr>
</table>
I have added the code in jsfiddle also, and here is the link http://jsfiddle.net/965XJ/1/
Any help on this will be appreciable.
Thanks, Kimz