Input Datetime type Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Datetime

Description

The type property returns the type of form datetime field.

Return Value

A String, representing the type of form datetime field

The following code shows how to return which type of form element the datetime field is:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

A datetime field: <input type="datetime" id="myDatetime">

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//ww  w . j  a va2 s . c om
    var x = document.getElementById("myDatetime").type;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials