I am using eonasdan's bootstrap 3 datetimepicker. I just wanted to know is it possible open the selector using the input field as well as the calendar glyphicon.
I know how to make it open using either the input field or the glyphicon but not both.
HTML is below:
<div class='input-group date'>
<input type='text' class="form-control" id='datetimepicker1'>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
<script type="text/javascript">
$('#datetimepicker1').datetimepicker({
format: 'ddd D MMMM, YYYY'
});
</script>
There is a function allowInputToggle
to open datepicker while clicking on both icon and input, which you can find here
$(document).ready(function(){
$('#datetimepicker1').datetimepicker({
format: 'ddd D MMMM, YYYY',
allowInputToggle: true
});
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/css/bootstrap-datetimepicker.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.6/moment.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.37/js/bootstrap-datetimepicker.min.js"></script>
<br><br><br>
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date' id='datetimepicker1'>
<input type='text' class="form-control" />
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>