Search code examples
eonasdan-datetimepicker

Bootstrap DateTimePicker Close Button Position


I am using Eonasdan Bootstrap-datetimepicker in my project ! Is there any option to change the position of close button from top to bottom ? (Not Widget Position). I searched in there documentation but I cant find it.

Thanks in advance


Solution

  • You must use the toolbarPlacement option for this.

    Default: 'default'

    Accepts: 'default', 'top', 'bottom'

    $('#myDatepicker').datetimepicker({
      toolbarPlacement: 'bottom',
      showClose: true,
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="https://cdn.rawgit.com/Eonasdan/bootstrap-datetimepicker/25c11d79/build/css/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    
    
    <br/>
    <!--Space for the fiddle-->
    <div class="container">
      <div class="row">
        <div class='col-sm-6'>
          <div class="form-group">
            <div class='input-group date' id='myDatepicker'>
              <input type='text' class="form-control" />
              <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
              </span>
            </div>
          </div>
        </div>
      </div>
    </div>