时间控件 datepicker
<div class="col-md-4"> <div class="form-group inblock"> <label class="col-sm-4 control-label" for="starttime">注册日期:</label> <div class="input-group" style="width: 250px;"> <input type="text" class="form-control datepicker" id="starttime" name="starttime" style="width: 207px;"> <div class="input-group-addon"> <a href="#"><i class="linecons-calendar"></i></a> </div> </div> </div> </div> <div class="col-md-4"> <div class="form-group inblock"> <label class="col-sm-4 control-label" for="endtime">-</label> <div class="input-group" style="width: 250px;"> <input type="text" class="form-control datepicker" id="endtime" name="endtime" style="width: 207px;"> <div class="input-group-addon"> <a href="#"><i class="linecons-calendar"></i></a> </div> </div> </div> </div>
//时间控件 $('#starttime').datepicker({ format: 'yyyy-mm-dd', todayBtn : "linked", language: 'zh-CN', autoclose : true //endDate : new Date() }).on('changeDate',function(e){ var startTime = e.date; $('#endtime').datepicker('setStartDate',startTime); }); $('#endtime').datepicker({ format: 'yyyy-mm-dd', todayBtn : "linked", autoclose : true, language: 'zh-CN' //endDate : new Date() }).on('changeDate',function(e){ var endTime = e.date; $('#starttime').datepicker('setEndDate',endTime); });