Input Week required property
Example
Check whether the week field is required before submitting the form:
var x = document.getElementById("myWeek").required;
x
The output is:
true
Try it »
Definition and Usage
The required property sets or returns whether the week field is required in a 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 .
Syntax
Return the required attribute:
weekObject
.required
Set the required attribute:
weekObject
.required=true|false
Attribute values
| Value | Description |
|---|---|
| true|false | Describes whether the week field is a required part before the form is submitted.
|
Technical Details
| Return Value: | A Boolean value; returns true if the week field is a required part of the form, otherwise returns false. |
|---|
More examples
Example
Set the week field as a required part of the form:
document.getElementById("myWeek").required = true;
Try it »
Related pages
HTML Reference Manual: HTML required attribute
The Input Week object