The min
property sets or gets the min attribute of a week field.
The min
attribute sets the minimum week and year for a week field.
min |
Yes | No | No | Yes | Yes |
Return the min property.
var v = weekObject.min
Set the min property.
weekObject.min=YYYY-WWW
Value | Description |
---|---|
YYYY-WWW | Specifies the minimum week and year allowed.
|
A String type value, representing the minimum week and year allowed.
The following code shows how to change the minimum week and year allowed.
<!DOCTYPE html>
<html>
<body>
<!--from w w w. ja va 2 s. c o m-->
Week and Year:
<input type="week" id="myWeek" min="2014-W12" max="2014-W19">
<button onclick="myFunction()">test</button>
<script>
function myFunction() {
var x = document.getElementById("myWeek").min = "2014-W16";
}
</script>
</body>
</html>
The code above is rendered as follows:
The following code shows how to get the minimum week and year allowed for a week field.
<!DOCTYPE html>
<html>
<body>
Enter a week between Week 12 and Week 19 in 2014:
<input type="week" id="myWeek" min="2014-W12" max="2014-W19">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!-- w ww.j av a2 s . c o m-->
var x = document.getElementById("myWeek").min;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: