I implemented bootstrap datepicker date-range in the below snippet but I don't see the range showing on the calendar after I have selected a date for start date and end date.
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.standalone.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page 2</title>
</head>
<body>
<div class="input-group input-daterange">
<input id="startDate1" name="startDate1" type="text"
class="form-control" readonly="readonly"> <span
class="input-group-addon"> <span
class="glyphicon glyphicon-calendar"></span>
</span> <span class="input-group-addon">to</span> <input id="endDate1"
name="endDate1" type="text" class="form-control" readonly="readonly">
<span class="input-group-addon"> <span
class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.input-daterange input').each(function() {
$(this).datepicker();
});
});
</script>
</body>
</html>
you need to add the bootstrap-datepicker css resource as well.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css" />
and use the below syntax for date range.
$('.input-daterange').datepicker({});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.min.css" />
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css"
href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/css/bootstrap-datepicker.standalone.min.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Page 2</title>
</head>
<body>
<div class="input-group input-daterange">
<input id="startDate1" name="startDate1" type="text"
class="form-control" readonly="readonly"> <span
class="input-group-addon"> <span
class="glyphicon glyphicon-calendar"></span>
</span> <span class="input-group-addon">to</span> <input id="endDate1"
name="endDate1" type="text" class="form-control" readonly="readonly">
<span class="input-group-addon"> <span
class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.6.4/js/bootstrap-datepicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.input-daterange').datepicker({
});
});
</script>
</body>
</html>
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