The Input type week method stepDown() used to decrease the week input field value by specified number. If value not specified, the default value considered as 1. It does not returns any value.
1 <input>.stepDown(<number>)
input : An input type week element to decrease the week field value
number : A number value to decrease week field value, the default value will be 1, if not specified
Input week method stepDown()
1 <!DOCTYPE html>
2 <html>
3 <style>
4 .container {
5 margin: 20px 0;
6 }
7 </style>
8 <body>
9 <h1>The Input Week Object</h1>
10 <h2>Example</h2>
11
12 <div class="container">
13 <input type="week" id="week" value="2021-W34" />
14 </div>
15 <div>
16 <button onclick="change(1)">Increase</button>
17 <button onclick="change(-1)">Decrease</button>
18 <button onclick="access()">Select</button>
19 </div>
20
21 <p id="result"></p>
22 <script>
23 function access() {
24 const element = document.getElementById("week");
25 const str = `The value of week field : <b>${element.value}</b>`;
26 document.getElementById("result").innerHTML = str;
27 }
28 function change(value) {
29 const element = document.getElementById("week");
30 value > 0 ? element.stepUp() : element.stepDown();
31 }
32 </script>
33 </body>
34 </html>
Input week method stepDown()
Related options for your search