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

Javascript examples for DOM HTML Element:Input Time

Description

Input Time required Property - Set a time field to be a required part of form submission:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form action="#">
  Time: <input type="time" id="myTime" name="usr_time">
  <input type="submit">
</form>/*from  w  ww.j a va2  s. c  om*/

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

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

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

</body>
</html>

Related Tutorials