Javascript Reference - HTML DOM Input Month type Property








The type property get the type of the month field.

Browser Support

type Yes No No Yes Yes

Syntax

var v  = monthObject.type

Return Value

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





Example

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


<!DOCTYPE html>
<html>
<body>
<!--  ww w  .  j a va2  s  . co  m-->
<input type="month" id="myMonth">
<button onclick="myFunction()">test</button>

<p id="demo"></p>

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

</body>
</html>

The code above is rendered as follows: