Input Week min Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Week

Description

The min property sets or gets the min attribute of a week field, which sets the minimum week and year for a week field.

Set the min property with the following Values

ValueDescription
YYYY-WWW Sets the minimum week and year allowed.
  • YYYY - year (e.g. 2011)
  • The literal string "-W" indicates "week"
  • WW - week (in the range of 1 to 52 or 53 )

Example: 2018-W15

Return Value

A String, representing the minimum week and year allowed

The following code shows how to get the minimum week and year allowed for a week field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Week and Year:/*w  w  w. j  a  va 2  s  .c  o m*/
<input type="week" id="myWeek" min="2018-W12" max="2018-W19">

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myWeek").min;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials