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