Javascript DOM HTML Input Time type Property get

Introduction

Return which type of form element the time field is:

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

Click the button to display which type of form element the time field is.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="time" id="myTime">
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//from  w w w . j  ava  2 s.com
  var x = document.getElementById("myTime").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The type property returns which type of form element the time field is.

The <input type="time"> element is not supported in Firefox.




PreviousNext

Related