The type
property returns the type of the datetime field.
type |
No | No | No | No | No |
var v = datetimeObject.type
A String type value representing the type of the datetime field.
The following code shows how to get the type of the datetime field.
<!DOCTYPE html>
<html>
<body>
A datetime field: <input type="datetime" id="myDatetime">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<!--from w w w. j av a 2 s. c om-->
<script>
function myFunction() {
var x = document.getElementById("myDatetime").type;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: