Input Month required Property - Set a month field to be a required part of form submission: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Month

Description

Input Month required Property - Set a month field to be a required part of form submission:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
  Month: <input type="month" id="myMonth" name="bdaymonth">
  <input type="submit">
</form>/*w  ww.j ava  2s  . co m*/

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

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

<script>
function myFunction() {
    document.getElementById("myMonth").required = true;
    document.getElementById("demo").innerHTML = "required property was set.";
}
</script>
</body>
</html>

Related Tutorials