Javascript examples for DOM HTML Element:Input Week
The value property sets or gets the value attribute of a week field.
Set the value property with the following Values
Value | Description |
---|---|
YYYY-WWW | Sets the week and year. |
Explanation of components:
Example: 2018-W15
A String, representing the year and week of the week field
The following code shows how to Set the week and year for a week field:
<!DOCTYPE html> <html> <body> <input type="week" id="myWeek" value="1995-W35"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {//from w w w . java 2 s .c o m document.getElementById("myWeek").value = '2000-W33'; document.getElementById("demo").innerHTML = 'changed'; } </script> </body> </html>