HTML DOM Input Week min Property


The HTML DOM Input Week min property returns/sets min attribute of Input Week.

Syntax

Following is the syntax −

  • Returning string value
inputWeekObject.min
  • Setting min to string value
inputWeekObject.min = YYYY-Www

String Values

Here, “YYYY-Www” can be the following −

stringValueDetails
YYYYIt defines year (eg:1990)
WIt is a separator for year and week
wwIt defines weeks (eg:07)

Example

Let us see an example for Input Week min property −

 Live Demo

<!DOCTYPE html>
<html>
<head>
<title>Input Week min</title>
<style>
   form {
      width:70%;
      margin: 0 auto;
      text-align: center;
   }
   * {
      padding: 2px;
      margin:5px;
   }
   input[type="button"] {
      border-radius: 10px;
   }
</style>
</head>
<body>
<form>
<fieldset>
<legend>Week-min</legend>
<label for="WeekSelect">Vacation Week:
<input type="week" id="WeekSelect" value="2019-W45" min="2020-W05">
</label>
<input type="button" onclick="getMinimum()" value="Go on a vacation">
<div id="divDisplay"></div>
</fieldset>
</form>
<script>
   var divDisplay = document.getElementById("divDisplay");
   var inputWeek = document.getElementById("WeekSelect");
   function getMinimum() {
      divDisplay.textContent = 'You can go on a vacation after: Week: '+inputWeek.min.split("-W")[1]+' ,'+inputWeek.min.split("-W")[0]
   }
</script>
</body>
</html>

Output

This will produce the following output −

Before clicking ‘Go on a vacation’ button −

After clicking ‘Go on a vacation’ button −

raja
Published on 26-Jul-2019 13:51:40
Advertisements