Surya Badrinath Surya Badrinath - 1 month ago 16
CSS Question

move the position of bootstrap datepicker

enter image description hereCan I able to move the datepicker near the calender icon ??? Any fix for this would be appreciated. datepicker is generated dynamically.


I have given id to div


enter image description here

<div class="datepick col-sm-6">
<div class='input-group date' id='datetimepicker1' >
<input type='text' class="form-control" placeholder="Select Start Date"/>
<span class="input-group-addon">
<span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
<script>
$('#datetimepicker1').datepicker({
autoclose: true,
startDate: '-0m',
todayHighlight: true
}).on('changeDate', function(ev){
$('#sDate1').text($('#datetimepicker1').data('date'));
$('#datetimepicker1').datepicker('hide');
});
</script>


enter image description here

Answer

What you need is little bit of jquery

see here

JQuery

$('#datetimepicker1').click(function(){
    var popup =$(this).offset();
    var popupTop = popup.top - 40;
    $('.ui-datepicker').css({
      'top' : popupTop
     });
});

About positioning of datepicker read here

Comments