Javascript Reference - HTML DOM Input Date type Property








The type property returns the type of the date field.

Browser Support

type Yes No No Yes Yes

Syntax

var v = inputdateObject.type 

Return Value

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





Example

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


<!DOCTYPE html>
<html>
<body>
<!-- w  ww .  j  a v a2s  . c  o  m-->
A date control: <input type="date" id="myDate">
<button onclick="myFunction()">test</button>

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

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

</body>
</html>

The code above is rendered as follows: