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

Javascript examples for DOM HTML Element:Input Week

Description

Input Week required Property - Set a week field to be a required part of form submission:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
  Week: <input type="week" id="myWeek" name="week_year">
  <input type="submit">
</form>/*  w  ww  . j  ava2 s .  co m*/

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

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

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

</body>
</html>

Related Tutorials