Input Week required attribute

Definition and Usage

required Attribute sets or returns whether the day field must be filled out before submitting the form.

This attribute reflects the HTML required attribute.

See also:

HTML Reference Manual:HTML <input> required ιδιότητα

Example

Example 1

Determine whether the day field must be filled out before submitting the form:

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

Try it yourself

Example 2

Set the day field as a required part of the form submission:

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

Try it yourself

Syntax

Return the required attribute:

weekObject.required

Set the required attribute:

weekObject.required = true|false

Attribute value

Value Description
true|false

Specify whether the day field should be a required part of the form submission.

  • true - The day field is a required part of the form submission.
  • false - Default. The day field is not a required part of the form submission.

Τεχνικές λεπτομέρειες

Επιστροφή τιμής: Boolean value, if the week field is a required part of the form submission, it returns true;αν όχι, επιστρέφει false.

Υποστήριξη περιηγητή

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Υποστήριξη 10.0 Υποστήριξη Υποστήριξη Υποστήριξη

Σημείωση:Το στοιχείο <input type="week"> δεν εμφανίζει κανένα πεδίο ημερομηνίας/ημερολόγιο στο Firefox.