Javascript Reference - HTML DOM Input Week type Property








The type property returns the type of the week field.

Browser Support

type Yes No No Yes Yes

Syntax

var v = weekObject.type

Return Value

A String type value representing the type of the week field.





Example

The following code shows how to get the type of the week field.


<!DOCTYPE html>
<html>
<body>
<!--   w w w.  jav a 2 s.  com-->
<input type="week" id="myWeek">
<button onclick="myFunction()">test</button>
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myWeek").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: