Input Week requiredProperty

Input Week 对象参考手册Input Week Object

Examples

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

var x = document.getElementById("myWeek").required;
xThe output result is:
true

Try it Yourself »

Definition and Usage

The required property is used to set or return whether the week field is a required field in the form.

This property reflects the HTML required attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All mainstream browsers support the required attribute, except Internet Explorer 9 and earlier IE versions, and Safari.

Note:Internet Explorer or Firefox browsers 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 Describes whether the week field is a required part before the form is submitted.
  • 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: Boolean value, returns true if the week field is a required part of the form, otherwise returns false.


More Examples

Examples

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

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

Try it Yourself »


Related Pages

HTML Reference Manual:HTML <input> required attribute


Input Week 对象参考手册Input Week Object Other Extensions