Javascript DOM HTML Input Time value Property get

Introduction

Get the value of a time field:

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

Click the button to get the time of the time field.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" value="21:43:54">
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {//www.  j  av a 2 s .  c o m
  var x = document.getElementById("myTime").value;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related