The Input Time object represents an HTML <input> element with type="time".
We can access an <input> element with type="time" via document.getElementById()
:
var x = document.getElementById("myTime");
Click the button to get the time of the time field.
<!DOCTYPE html> <html> <body> <input type="time" id="myTime" value="22:15:00"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {// w ww.j av a 2 s . c om var x = document.getElementById("myTime").value; document.getElementById("demo").innerHTML = x; } </script> </body> </html>