This article mainly introduces the javascript date verification input date is greater than or equal to the current date, you can refer to the example of this article to analyze the javascript input date is greater than or equal to the current date verification code, we will share this with you for your reference. The details are as follows:
Script $ (function () {var d = new Date (); var strDate = getDateStr (d); $ ("# beginTime "). val (strDate); $ ("# endTime "). val (strDate); // $ ("# beginTime "). val ("2015-10-10"); $ ("# beginTime "). change (function () {var d2 = new Date ($ ("# beginTime "). val (); if (d2 <d) {alert ("the start date must be later than the current date. "); $ (" # beginTime "). val (strDate) ;}}); $ ("# endTime "). change (function () {var d2 = new Date ($ ("# beginTime "). val (); var d3 = new Date ($ ("# endTime "). val (); if (d3 <d2) {alert ("the completion date cannot be earlier than the start date. "); $ (" # endTime "). val (getDateStr (d2) ;}}) ;}); function getDateStr (date) {var month = date. getMonth () + 1; var strDate = date. getFullYear () + '-' + month + '-' + date. getDate (); return strDate;} script
I hope this article will help you design JavaScript programs.