YouTip LogoYouTip

Prop Week Required

HTML DOM Input Week required Attribute

HTML DOM Input Week required Attribute

Input Week required Attribute

Input Week Object

Example

Check if the week field is a required field before submitting the form:

var x = document.getElementById("myWeek").required;

x output will be:

true

Try it yourself Β»


Definition and Usage

The required property sets or returns whether the week field in a form must be filled out before submitting the form.

This property reflects the HTML required attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

The required property is supported in all major browsers, except Internet Explorer 9 and earlier, and Safari.

Note: Internet Explorer and Firefox do not support the <input type="week"> element.


Syntax

Return the required property:

weekObject.required

Set the required property:

weekObject.required=true|false

Property Values

Value Description
true|false Specifies whether the week field must be filled out before submitting the form.
  • true - The week field is a required part of the form
  • false - Default. The week field is an optional part of the form.

Technical Details

Return Value: A Boolean. Returns true if the week field is a required part of the form, otherwise it returns false.

More Examples

Example

Set the week field as a required part of the form:

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

Try it yourself Β»


Related Pages

HTML Reference: HTML <input> required Attribute


Input Week Object

← Prop Week TypeProp Week Required β†’