<Script> $(function () { varD= NewDate (); varstrdate=Getdatestr (d); $("#beginTime"). Val (strdate); $("#endTime"). Val (strdate); //$ ("#beginTime"). Val ("2015-10-10"); $("#beginTime"). Change (function () { varD2= NewDate ($ ("#beginTime"). Val ()); if(D2<d) {alert ("the commencement date must be greater than the current date."); $("#beginTime"). Val (strdate); } }); $("#endTime"). Change (function () { varD2= NewDate ($ ("#beginTime"). Val ()); varD3= NewDate ($ ("#endTime"). Val ()); if(D3<D2) {Alert ("the completed date cannot be less than the commencement date."); $("#endTime"). Val (Getdatestr (D2)); } }); }); functionGetdatestr (date) {varMonth=Date.getmonth ()+ 1; varstrdate=date.getfullyear ()+ '-' +Month+ '-' +date.getdate (); returnstrdate; }</Script>
JavaScript Date Validation: Fill in a date greater than or equal to the current date