Dofactory.com
Dofactory.com

HTML <textarea> required Attribute

The required attribute on a <textarea> tag specifies that a value must be provided before submitting the form.

This is part of the HTML built-in validation function.

Example

#

A required attribute on a <textarea> element.
The textarea must have a value (i.e. text) before the form can be submitted.




<form action="/tutorial/action.html">
  <label for="message">*Message</label><br/>
  <textarea required name="message" rows="5" cols="55"></textarea>

  <br /><br />
  <input type="submit">
</form>

Using required

The required attribute specifies that the textarea must be filled out before submitting the form. If not, an error message appears.

This attribute is part of the built-in validation functionality in HTML.


Syntax

<textarea required>

Browser support

Here is when required support started for each browser:

Chrome
1.0 Sep 2008
Firefox
4.0 Mar 2011
IE/Edge
10.0 Sep 2012
Opera
1.0 Jan 2006
Safari
1.0 Jan 2003

You may also like

 Back to <textarea>

Author: Jack Poorte
Published: Jun 20 2021
Last Reviewed: Sep 30 2023


What's your favorite/least favorite part of Dofactory?


Guides