Back to Content

HTMLTextAreaElement: required property

files/en-us/web/api/htmltextareaelement/required/index.md

latest658 B
Original Source

{{ APIRef("HTML DOM") }}

The required property of the {{DOMxRef("HTMLTextAreaElement")}} interface specifies that the user must fill in a value before submitting a form. It reflects the {{htmlelement("textarea")}} element's required attribute.

Value

A boolean.

Examples

js
const textareaElement = document.getElementById("comment");
console.log(textArea.required);

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also

  • {{HTMLElement("textarea")}}
  • {{DOMXref("HTMLTextAreaElement.validity")}}
  • {{cssxref(":required")}} pseudo-class