Javascript examples for DOM HTML Element:Input Time
The min property sets or gets the min attribute of a time field, which sets the minimum time for a time field.
Tip: Use the min attribute together with the max attribute to create a range of legal values.
Tip: To set or return the value of the max attribute, use the max property.
The <input type="time"> element does not show as any time field in Firefox.
Set the min property with the following Values
Value | Description |
---|---|
hh:mm:ss.ms | Sets the minimum time allowed for the time field. |
A String, representing the minimum time allowed for the time field
The following code shows how to get the minimum 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() {/* www . j ava 2 s .c o m*/ var x = document.getElementById("myTime").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>