首先需要引入CSS:datepicker.css
然后引入JS:bootstrap-datepicker.js、bootstrap-datepicker.zh-CN.js(中文显示用到)
元素:
<input class="useable-time-input" id="useable-start-time-input" type="text" readonly name=""
value="" placeholder="生效时间" />
然后初始化日期
$('.useable-time-input').datepicker({
format: 'yyyy-mm-dd',
language: 'zh-CN',
autoclose: true,
todayHighlight: true
}).on("show", function (ev) {
ev.stopPropagation();
});