Input Time required property
Example
Check whether the time field is a required field before submitting the form:
var x = document.getElementById("myTime").required;
x
The output is:
true
Try it »
Definition and Usage
The required property sets or returns whether the time field is required in the form.
This attribute reflects the HTML required attribute.
Browser support





All major browsers support the required attribute, except Internet Explorer 9 and earlier versions and the Safari browser.
Note: Internet Explorer or Firefox browsers do not support HTML using the type="time" attribute .
Syntax
Return the required attribute:
timeObject
.required
Set the required attribute:
timeObject
.required=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the time field is a required part before the form is submitted.
|
Technical Details
| Return Value: | Boolean value, returns true if the time field is a required part of the form, otherwise returns false. |
|---|
More examples
Example
Set the time field as a required part of the form:
document.getElementById("myTime").required = true;
Try it »
Related pages
HTML required attribute
Input Time Object