Input Month required attribute

Definition and Usage

required Set or return whether the month field must be filled out before submitting the form.

This attribute reflects the HTML required attribute.

See also:

HTML Reference Manual:Η ιδιότητα required του HTML <input> στο Firefox δεν εμφανίζει κανένα πεδίο ημερομηνίας/ημερολόγιο.

Example

Example 1

Determine if the month field must be filled out before submitting the form:

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

Try it yourself

Example 2

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

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

Try it yourself

Syntax

Return the required attribute:

monthObject.required

Set the required attribute:

monthObject.required = true|false

Attribute value

Value Description
true|false

Define whether the month field should be a required part of the form submission.

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

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

Επιστροφή τιμής: Βοολοένας, αν το πεδίο μήνα είναι υποχρεωτικό μέρος της υποβολής φόρμας, τότε επιστρέφει true;ή επιστρέφει false.

Υποστήριξη ΒROWSER

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

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