Javascript Reference - HTML DOM Input DatetimeLocal type Property








The type property returns the type of the local datetime field.

Browser Support

type Yes No No Yes Yes

Syntax

var v = datetimelocalObject.type

Return Value

A String type value representing the type of the local datetime field.





Example

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


<!DOCTYPE html>
<html>
<body>
<input type="datetime-local" id="myLocalDate">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!--from   w  w  w  . ja va  2s . c  om-->
    var x = document.getElementById("myLocalDate").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: