button for Date and Time in Bootstrap Datetimepicker

时间:2016-04-04 17:21:42

标签: javascript jquery angular-ui-bootstrap eonasdan-datetimepicker

I'm trying to have two buttons. One for time and another for date. For example http://jsfiddle.net/RR4hw/1383/

<div class="container">
<div class="col-sm-6" style="height:75px;">
   <div class='col-md-5'>
        <div class="form-group">
            <div>Start</div>

            <div class='input-group date' id='startDate'>
                <input type='text' class="form-control" name="startDate" readonly />
                <span class="input-group-addon">
        <span class="glyphicon glyphicon-calendar"></span>
        <span class="glyphicon glyphicon-time"></span>
                </span>
            </div>
        </div>
    </div>

  </div>
</div>

jQuery(function () {
  jQuery('#startDate').datetimepicker();
  jQuery('#endDate').datetimepicker();
  jQuery("#startDate").on("dp.change",function (e) {
    jQuery('#endDate').data("DateTimePicker").setMinDate(e.date);
  });
});

how can i approach it? Is this possible?

1 个答案:

答案 0 :(得分:0)

我通过使用选项“sideBySide”解决了这个问题:

jQuery('#startDate').datetimepicker({sideBySide: true});
jQuery('#endDate').datetimepicker({sideBySide: true});

我希望它有所帮助。