Javascript examples for DOM HTML Element:Input Date
The min property sets or gets the min attribute of a date field, which controls the minimum date for a date field.
Set the min property with the following Values
Value | Description |
---|---|
YYYY-MM-DD | Sets the minimum date allowed for the date field. |
An example: "2018-02-09" means February 9th, 2018 (09/02/2018).
A String, representing the minimum date allowed
The following code shows how to get the minimum date allowed for a date field:
<!DOCTYPE html> <html> <body> Date:// www .ja v a 2 s. c om <input type="date" id="myDate" name="bday" min="1980-01-01" max="2000-01-01"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myDate").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>