![]() |
Definition and UsageThe The A text area can hold an unlimited number of characters, and the text renders in a fixed-width font (usually Courier). The size of a text area is specified by the The The Tip: Always add the <label> tag for best accessibility practices! Browser SupportAttributes
Global AttributesThe Event AttributesThe |
Example:
HTML
<label for="w3review">Review of W3Schools:</label>
<textarea id="w3review" name="w3review" rows="4" cols="50">
At horje.com you will learn how to make a website. They offer free tutorials in all web development technologies.
</textarea>
The textarea element - Disable default resize option.
Example:
HTML
<!DOCTYPE html>
<html>
<head>
<style>
textarea {
resize: none;
}
</style>
</head>
<body>
<h1>The textarea element - Disable default resize option</h1>
<p><label for="w3review">Review of Horje:</label></p>
<textarea id="w3review" name="w3review" rows="4" cols="50">
At horje.com you will learn how to make a website. They offer free tutorials in all web development technologies.
It is A text area with autofocus.
Example:
HTML
<textarea autofocus>
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
It is A text area with a specified height and width.
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The textarea rows and cols attributes</h1>
<textarea rows="4" cols="50">
At horje.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
<p>This textarea has 4 visible rows.</p>
<p>You can change that by changing the value of the "rows" attribute.</p>
</body>
</html>
It is An HTML form where the field's text direction will be submitted.
Example:
HTML
<form action="/action_page.php">
Text:
<textarea name="explanation" dirname="explanation.dir"></textarea>
<input type="submit" value="Submit">
</form>
It is A disabled text area.
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The textarea disabled attribute</h1>
<textarea disabled>
At horje.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
</body>
</html>
It is A text area located outside a form (but still a part of the form).
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The textarea form attribute</h1>
<form action="/action_page.php" id="usrform">
Name: <input type="text" name="usrname">
<input type="submit">
</form>
<br>
<textarea rows="4" cols="50" name="comment" form="usrform">
Enter text here...</textarea>
<p>The text area above is outside the form element, but should still be a part of the form.</p>
</body>
</html>
It is A text area with a maximum length of 50 characters.
Example:
HTML
<textarea maxlength="50">
Enter text here...
</textarea>
It is A text area with a name attribute.
The name
attribute specifies a name for a text area.
The name
attribute is used to reference elements in a JavaScript, or to reference form data after a form is submitted.
<textarea name="text">
Value | Description |
---|---|
text | Specifies the name of the text area |
Example:
HTML
<form action="/action_page.php">
<textarea name="comment">Enter text here...</textarea>
<input type="submit">
</form>
The placeholder
attribute specifies a short hint that describes the expected value of a text area.
The short hint is displayed in the text area before the user enters a value.
The numbers in the table specify the first browser version that fully supports the attribute.
<textarea placeholder="text">
Value | Description |
---|---|
text | Specifies a short hint that describes the expected value of the text area |
It is A text area with a placeholder text.
Example:
HTML
<textarea placeholder="Describe yourself here..."></textarea>
The readonly
attribute is a boolean attribute.
When present, it specifies that a text area should be read-only.
In a read-only text area, the content cannot be changed, but a user can tab to it, highlight it and copy content from it.
The readonly
attribute can be set to keep a user from using a text area until some other condition has been met (like selecting a checkbox, etc.). Then, a JavaScript is required to remove the readonly value, and make the text area editable.
<textarea readonly>
Example:
HTML
<textarea readonly>
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
It is A form with a required text area.
Example:
HTML
<form action="/action_page.php">
<textarea name="comment" required></textarea>
<input type="submit">
</form>
The rows
attribute specifies the visible height of a text area, in lines.
Note: The size of a textarea can also be specified by the CSS height and width properties.
<textarea rows="number">
Value | Description |
---|---|
number | Specifies the height of the text area (in lines). Default value is 2 |
Example:
HTML
<textarea rows="4" cols="50">
At w3schools.com you will learn how to make a website. We offer free tutorials in all web development technologies.
</textarea>
The wrap
attribute specifies how the text in a text area is to be wrapped when submitted in a form.
<textarea wrap="soft|hard">
Value | Description |
---|---|
soft | The text in the textarea is not wrapped when submitted in a form. This is default |
hard | The text in the textarea is wrapped (contains newlines) when submitted in a form. When "hard" is used, the cols attribute must be specified |
Example:
HTML
<textarea rows="2" cols="20" wrap="hard">
At W3Schools you will find free Web-building tutorials.
</textarea>
soft | The text in the textarea is not wrapped when submitted in a form. This is default |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The textarea wrap attribute</h1>
<form action="/action_page.php">
<textarea rows="2" cols="20" name="usrtxt" wrap="soft">
At horje you will find free Web-building tutorials.
</textarea>
<input type="submit">
</form>
</body>
</html>
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<h1>The textarea wrap attribute</h1>
<form action="/action_page.php">
<textarea rows="2" cols="20" name="usrtxt" wrap="hard">
At horje you will find free Web-building tutorials.
</textarea>
<input type="submit">
</form>
</body>
</html>
html textarea |
Read Full: | HTML Tag |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Tag |
Uploaded: | 3 weeks ago |
Uploaded by: | Admin |
Views: | 49 |
Reffered: https://www.w3schools.com/tags/tag_textarea.asp