Get Input Date - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Date


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

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<input type="date" id="myDate" value="2014-02-09">

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

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

function myFunction() {//from   w  ww .j av  a2 s  . c o  m
    var x = document.getElementById("myDate").value;
    document.getElementById("demo").innerHTML = x;


Related Tutorials