Input Month defaultValue Property - Get the default value of a month field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Month

Description

Input Month defaultValue Property - Get the default value of a month field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

Month and year: <input type="month" id="myMonth" value="1997-11">

<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {/*ww  w.j a v a2s .  c o  m*/
    var x = document.getElementById("myMonth").defaultValue;
    document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>

Related Tutorials