Javascript examples for DOM HTML Element:Input Time
The max property sets or gets the max attribute of a time field, which sets the maximum value (time) for a time field.
Set the max property with the following Values
Value | Description |
---|---|
hh:mm:ss.ms | Sets the maximum time allowed for the time field. |
A String, representing the maximum time allowed for the time field
The following code shows how to get the maximum time allowed for a time field:
<!DOCTYPE html> <html> <body> Time: <input type="time" id="myTime" min="20:00" max="22:00"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from www . j a v a 2s. com*/ var x = document.getElementById("myTime").max; document.getElementById("demo").innerHTML = x; } </script> </body> </html>