YouTip LogoYouTip

Prop Input Time Required

HTML DOM Input Time required Property

HTML DOM Input Time required Property

Image 8: Input Time Object Reference Input Time Object

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

Try it yourself Β»


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

Image 9: Internet ExplorerImage 10: FirefoxImage 11: OperaImage 12: Google ChromeImage 13: Safari

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.
  • true - The time field is a required part of the form.
  • false - Default. The time field is an optional part of 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;

Try it yourself Β»


Related Pages

HTML <input> required Attribute


Image 14: Input Time Object Reference Input Time Object

← Prop Input Time RequiredProp Input Time Readonly β†’