HTML DOM Input Time required Property
Example
Check if the time field is a required field before submitting the form:
var x = document.getElementById("myTime").required;
x output result is:
true
Definition and Usage
The required property sets or returns whether the time field in a form must be filled out before submitting the form.
This property reflects the HTML required attribute.
Browser Support
The required property is supported in all major browsers, except Internet Explorer 9 and earlier, and Safari.
Note: Internet Explorer or Firefox does not support the HTML <input> element with the type="time" attribute.
Syntax
Return the required property:
timeObject.required
Set the required property:
timeObject.required=true|false
Property Values
| Value | Description |
|---|---|
| true|false | Specifies whether the time field must be filled out before submitting the form.
|
Technical Details
| Return Value: | A Boolean. Returns true if the time field is a required part of the form, otherwise false. |
|---|
More Examples
Example
Set the time field as a required part of the form:
document.getElementById("myTime").required = true;
Related Pages
HTML <input> required Attribute
YouTip