时间:2021-07-01 10:21:17 帮助过:22人阅读
$(document).ready(function() {
$("#<%= btnSubmit.ClientID %>").click(function() {
$("#aspnetForm").validate({
rules: {
ctl00$ContentPlaceHolder1$ucProjInfo1$ucDatePicker2$txtDatePicker: {
required: true,
date: true,
//日期比较验证方法
endDate: true
}
}
});
});
//自定义验证方法
jQuery.validator.addMethod("endDate",
function(value, element) {
var startDate = $('#start_date').val();
return new Date(Date.parse(startDate.replace("-", "/"))) <= new Date(Date.parse(value.replace("-", "/")));
},
"结束日期必须大于开始日期!");
});