Get Input Time Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Time

Introduction

The Input Time object represents an HTML <input> element with type="time".

You can access an <input> element with type="time" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="time" id="myTime" value="22:15:00">

<button onclick="myFunction()">get the time of the time field</button>

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

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

</body>
</html>

Related Tutorials