Javascript DOM HTML Input DatetimeLocal type Property get

Introduction

Return which type of form element the local datetime field is:

var x = document.getElementById("myLocalDate").type;

Click the button to return which type of form element the local datetime field is.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="datetime-local" id="myLocalDate">
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {//from  w  ww .  j  a v a 2 s. c o  m
  var x = document.getElementById("myLocalDate").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

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




PreviousNext

Related