Official Address: http://bassistance.de/jquery-plugins/jquery-plugin-validation/
Foot home http://www.jb51.net/jiaoben/17478.html
Due to project requirements, it is essential to have a serious date size, but the Validation plug-in does not have this function. In this case, we need to extend a custom verification method. The Code is as follows:
Copy codeThe 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 Verification 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 later than the start date! ");
});