Javascript examples for Date Operation:Date Validate
Previous date validation
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//from w w w. j a va 2s.c om var el = document.getElementById("mydate"); el.onchange = onChangeDate; function onChangeDate(e){ if(new Date(el.value) < new Date()){ console.log("invalid date"); } } } </script> </head> <body> <input type="date" id="mydate"> </body> </html>