Easy Tutorial
❮ Prop Text Name Dom Obj Meter ❯

Input Week required Attribute

Input Week Object

Example

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

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

Definition and Usage

The required attribute is used to set or return whether the week 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 <input type="week"> element.


Syntax

Return the required attribute:

Set the required attribute:

Attribute Values

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

Technical Details

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


More Examples

Example

Set the week field as mandatory for the form:

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

Related Pages

HTML Reference: HTML <input> required Attribute


❮ Prop Text Name Dom Obj Meter ❯