Get the minimum week and year allowed for a week field:
var x = document.getElementById("myWeek").min;
Click the button to display the min attribute of the week field.
input elements with type="week" are not supported in Internet Explorer or Firefox.
<!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() {//from ww w. ja va2 s .c o m var x = document.getElementById("myWeek").min; document.getElementById("demo").innerHTML = x; } </script> </body> </html>
The min property sets or gets the value of the min attribute of a week field.
The min attribute sets the minimum week and year for a week field.
The <input type="week"> element is not supported in Firefox.
Property Values
Value | Description |
---|---|
YYYY-WWW Specifies the maximum week and year allowed. YYYY - year (e.g. 2020) The literal string "-W" indicates "week" WW - week (in the range of 1 to 52 or 53, e.g. 01 for the first week of the year) Example: 2014-W15 |
The min property returns a String representing the minimum week and year allowed.