$('#d_year').datepicker({
language: 'zh-CN',
format: 'yyyy',
rtl: KTUtil.isRTL(),
clearBtn: true,
todayHighlight: true,
templates: arrows,
orientation: "bottom left",
startView: 2,
minViewMode: 2,
maxViewMode: 2,
multidate:true,
}).on('change',function(e){
//其他处理
var yearArr = this.value.split(",");
if(yearArr.length>4){
layer.msg("只能选四个年份");
$("#d_year").datepicker("update", "");//初始化
}else{
//do something...
}
});
页面效果