The Input Week object represents an HTML <input> element with type="week".
<input> elements with type="week" are not supported in Firefox.
We can access an <input> element with type="week" via document.getElementById()
:
var x = document.getElementById("myWeek");
Click the button to get the week and year of the week field.
input elements with type="week" are not supported in Internet Explorer or Firefox.
<!DOCTYPE html> <html> <body> <input type="week" id="myWeek" value="2014-W15"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w. j ava2 s. c o m*/ var x = document.getElementById("myWeek").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>