Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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 −
| stringValue | Details |
|---|---|
| YYYY | It defines year (eg:1990) |
| W | It is a separator for year and week |
| ww | It defines weeks (eg:07) |
Example
Let us see an example for Input Week min property −
<!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 −

Advertisements