Get Input Date - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Date

Introduction

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>
<html>
<body>

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

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

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

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

</body>
</html>

Related Tutorials