Easy Tutorial
❮ Jsref Pop Prop Select Disabled ❯

Input Time required Attribute

Input Time Object

Example

Check if the time field is required before submitting the form:

var x = document.getElementById("myTime").required;
true

Definition and Usage

The required attribute is used to set or return whether the time field is mandatory 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 Safari.

Note: Internet Explorer and Firefox do not support the HTML <input> element with the type="time" attribute.


Syntax

Return the required attribute:

Set the required attribute:

Attribute Values

Value Description
true false Describes whether the time field is required before form submission. true - The time field is mandatory for the form. false - Default. The time field is optional for the form.

Technical Details

| Return Value: | Boolean, returns true if the time field is mandatory for the form, otherwise returns false. | | --- | --- |


More Examples

Example

Set the time field as mandatory for the form:

document.getElementById("myTime").required = true;

Related Pages


❮ Jsref Pop Prop Select Disabled ❯