Official address: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
Script Homehttp://www.jb51.net/jiaoben/17478. html
Due to the needs of the project, it is essential that the date size is relatively large, but the Validation plug-in does not have this function. At this time, we need to extend a custom verification method. The code is as follows:
$(document).ready(function() {
$("#<%= btnSubmit.ClientID %>").click(function() {
$("#aspnetForm").validate({
rules: {
ctl00$ ContentPlaceHolder1$ucProjInfo1$ucDatePicker2$txtDatePicker: {
required: true,
date: true,
//Date comparison verification method
endDate: true
}
}
} );
});
//Custom validation method
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("-" , "/")));
},
"The end date must be greater than the start date!");
});