- Attribute of
- HTML5 Textarea Attributes: Here's What You Should Know
- What does
- Adds a name attribute to a <textarea> element and associates the name with the text added to the text area.
<textarea name="opinion" placeholder="What do you think?"></textarea>
What's in a
name attribute is a global attribute that can be used on many different HTML elements. When applied to a
textarea the attribute is automatically associated with the value submitted with that form field, and can then be used to reference the data associated with the
name the same as an
One point of confusion that often comes up when dealing with HTML forms is the difference between
id attributes. While the two attributes are similar in some ways, they are also different in some very important ways.
- IDs can only be used once in an HTML document while names can be applied to multiple elements.
- Names are attached to the value submitted in a form field while IDs are not.