<div class="input-group date date-picker" data-date-format="yyyy-mm-dd">
<input type="text" class="form-control" readonly name="start" required>
<span class="input-group-btn"><button class="btn default" type="button" >
<i class="fa fa-calendar"></i></button></span> </div>
如何创建验证datepicker bootsrap?
答案 0 :(得分:0)
您可以像这样验证日期选择器:
$(document).ready(function(){
$("#datepicker").datepicker();
$("#datepicker").blur(function(){
val = $(this).val();
val1 = Date.parse(val);
if (isNaN(val1) == true && val !== ''){
alert("error");
}
else{
console.log(val1);
}
});
});