The min
property sets or gets the min attribute of a time field.
The min
attribute specifies the minimum time for a time field.
min |
Yes | No | No | Yes | Yes |
Return the min property.
var v = timeObject.min
Set the min property.
timeObject.min=hh:mm:ss.ms
Value | Description |
---|---|
hh:mm:ss.ms | Set the minimum time allowed for the time field.
|
A String type value representing the minimum time allowed for the time field.
The following code shows how to change the minimum value.
<!DOCTYPE html>
<html>
<body>
Time: <input type="time" id="myTime" min="20:00" max="22:00">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {<!--from w w w.ja va 2s.com-->
var x = document.getElementById("myTime").min = "16:00";
}
</script>
</body>
</html>
The code above is rendered as follows:
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>
<!--from w ww . j a v a2 s .c om-->
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myTime").min;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: