HTML
Có thể bạn quan tâm
- Courses
- DSA to Development
- Machine Learning & Data Science
- Generative AI & ChatGPT
- Become AWS Certified
- DSA Courses
- Data Structure & Algorithm(C++/JAVA)
- Data Structure & Algorithm(Python)
- Data Structure & Algorithm(JavaScript)
- Programming Languages
- CPP
- Java
- Python
- JavaScript
- C
- All Courses
- Tutorials
- Python Tutorial
- Taking Input in Python
- Python Operators
- Python Data Types
- Python Loops and Control Flow
- Python Conditional Statements
- Python Loops
- Python Functions
- Python OOPS Concept
- Python Data Structures
- Python Exception Handling
- Python File Handling
- Python Exercises
- Java
- Learn Java Programming Language
- Java Collections
- Java 8 Tutorial
- Java Programs
- Java Interview Questions
- Java Interview Questions
- Core Java Interview Questions-Freshers
- Java Multithreading Interview Questions
- OOPs Interview Questions and Answers
- Java Exercises
- Java Quiz
- Java Quiz
- Core Java MCQ
- Java Projects
- Advance Java
- Spring Tutorial
- Spring Boot Tutorial
- Spring Boot Interview Questions
- Spring MVC Tutorial
- Spring MVC Interview Questions
- Hibernate Tutorial
- Hibernate Interview Questions
- Programming Languages
- JavaScript
- C++
- R Tutorial
- SQL
- PHP
- C#
- C
- Scala
- Perl
- Go Language
- Kotlin
- System Design
- System Design Tutorial
- Software Design Patterns
- System Design Roadmap
- Top 10 System Design Interview Questions and Answers
- Interview Corner
- Company Preparation
- Top Topics
- Practice Company Questions
- Interview Experiences
- Experienced Interviews
- Internship Interviews
- Competitive Programming
- Multiple Choice Quizzes
- Aptitude for Placements
- Computer Science Subjects
- Operating System
- DBMS
- Computer Networks
- Engineering Mathematics
- Computer Organization and Architecture
- Theory of Computation
- Compiler Design
- Digital Logic
- Software Engineering
- DevOps
- GIT
- AWS
- Docker
- Kubernetes
- Microsoft Azure Tutorial
- Google Cloud Platform
- Linux
- Linux Tutorial
- Linux Commands A-Z
- Linux Commands Cheatsheet
- File Permission Commands
- Linux System Administration
- Linux File System
- Linux Shell Scripting
- Linux Networking
- Linux Interview Questions
- Software Testing
- Software Testing Tutorial
- Software Engineering Tutorial
- Testing Interview Questions
- Jira
- Databases
- DBMS Tutorial
- SQL Tutorial
- PostgreSQL Tutorial
- MongoDB Tutorial
- SQL Interview Questions
- MySQL Interview Questions
- PL/SQL Interview Questions
- Android
- Android Tutorial
- Android Studio Tutorial
- Kotlin For Android
- Android Projects
- Android Interview Questions
- 6 Weeks of Android App Development
- Excel
- MS Excel Tutorial
- Introduction to MS Excel
- Data Analysis in Excel
- Basic Excel Formulas & Functions
- Data Analysis in Advanced Excel
- Workbooks
- Statistical Functions
- Data Visualization in Excel
- Pivot Tables in Excel
- Excel Spreadsheets in Python
- Basic Excel Shortcuts
- Mathematics
- Number System
- Algebra
- Linear Algebra
- Trigonometry
- Set Theory
- Statistics
- Probability
- Geometry
- Mensuration
- Logarithms
- Calculus
- Python Tutorial
- DSA
- Data Structures
- Arrays
- Matrix
- Strings
- Linked List
- Stack
- Queue
- Tree
- Heap
- Hashing
- Graph
- Set Data Structure
- Map Data Structure
- Advanced Data Structure
- Data Structures Tutorial
- Algorithms
- Analysis of Algorithms
- Design and Analysis of Algorithms
- Asymptotic Analysis
- Asymptotic Notations
- Worst, Average and Best Cases
- Searching Algorithms
- Linear Search
- Binary Search
- Searching Algorithms Tutorial
- Sorting Algorithms
- Selection Sort
- Bubble Sort
- Insertion Sort
- Merge Sort
- Quick Sort
- Heap Sort
- Counting Sort
- Radix Sort
- Bucket Sort
- Sorting Algorithms Tutorial
- Greedy Algorithms
- Dynamic Programming
- Graph Algorithms
- Pattern Searching
- Recursion
- Backtracking
- Divide and Conquer
- Mathematical Algorithms
- Geometric Algorithms
- Bitwise Algorithms
- Randomized Algorithms
- Branch and Bound
- Algorithms Tutorial
- Analysis of Algorithms
- DSA Tutorial
- Practice
- All DSA Problems
- Problem of the Day
- Company Wise Coding Practice
- Amazon
- Microsoft
- Flipkart
- Explore All
- GfG SDE Sheet
- Practice Problems Difficulty Wise
- School
- Basic
- Easy
- Medium
- Hard
- Language Wise Coding Practice
- CPP
- Java
- Python
- Curated DSA Lists
- Beginner's DSA Sheet
- Top 50 Array Problems
- Top 50 String Problems
- Top 50 DP Problems
- Top 50 Graph Problems
- Top 50 Tree Problems
- Competitive Programming
- Company Wise SDE Sheets
- Facebook SDE Sheet
- Amazon SDE Sheet
- Apple SDE Sheet
- Netflix SDE Sheet
- Google SDE Sheet
- DSA Cheat Sheets
- SDE Sheet
- DSA Sheet for Beginners
- FAANG Coding Sheet
- Product-Based Coding Sheet
- Company-Wise Preparation Sheet
- Top Interview Questions
- Puzzles
- All Puzzles
- Top 100 Puzzles Asked In Interviews
- Top 20 Puzzles Commonly Asked During SDE Interviews
- Data Structures
- Data Science
- Python Tutorial
- R Tutorial
- Machine Learning
- Data Science using Python
- Data Science using R
- Data Science Packages
- Pandas Tutorial
- NumPy Tutorial
- Data Visualization
- Python Data Visualization Tutorial
- Data Visualization with R
- Data Analysis
- Data Analysis with Python
- Data Analysis with R
- Deep Learning
- NLP Tutorial
- Web Tech
- HTML Tutorial
- CSS Tutorial
- JavaScript Tutorial
- PHP Tutorial
- ReactJS Tutorial
- NodeJS Tutorial
- Bootstrap Tutorial
- Typescript
- Web Development Using Python
- Django
- Django Tutorial
- Django Projects
- Django Interview Questions
- Flask
- Flask Tutorial
- Flask Projects
- Flask Interview Questions
- Postman
- Github
- Django
- Cheat Sheets
- HTML Cheat Sheet
- CSS Cheat Sheet
- JavaScript Cheat Sheet
- React Cheat Sheet
- Angular Cheat Sheet
- jQuery Cheat Sheet
- Bootstrap Cheat Sheet
- Learn Complete Web Development
- HTML Tutorial
- HTML Exercises
- HTML Tags
- HTML Attributes
- Global Attributes
- Event Attributes
- HTML Interview Questions
- HTML DOM
- DOM Audio/Video
- HTML 5
- HTML Examples
- Color Picker
- A to Z Guide
- HTML Formatter
The HTML <textarea> tag is used to define a multi-line plain-text editing control. It’s commonly used in forms to collect user inputs such as comments, reviews, or any form of text entry. Attributes like cols and rows define its size, while the name attribute is needed for form data submission and the id attribute for label linkage. Text within a <textarea> is rendered in a fixed-width font.
Syntax:
<textarea>....</textarea>HTML textarea tag Attribute values
Attribute | Description |
---|---|
autocomplete | Specifies whether the textarea field has autocompleted on or off. |
autofocus | Specifies that the textarea field should automatically receive focus when the page loads. |
cols | Tells the browser how many average-width characters should fit on a single line, i.e., the number of columns. |
dirname | Enables setting the text direction of the textarea field after submitting the form. |
disabled | Specifies that the textarea element is disabled. |
form | Specifies one or more forms that the <textarea> element belongs to. |
maxlength | Specifies the maximum number of characters entered into the textarea element. |
minlength | Defines the minimum number of characters (as UTF-16 code units) of a textarea element. |
name | Specifies the name of the <textarea> element. |
placeholder | Specifies the expected value to be displayed before user input in the textarea element. |
readonly | Specifies that the textarea element is read-only. If the textarea is read-only, then its content cannot be changed but can be copied and highlighted. |
required | A boolean attribute that specifies that the <textarea> element must be filled out before submitting the form. |
rows | Specifies the number of visible text lines for the control, i.e., the number of rows to display. |
wrap | Specifies in which manner the text is to be wrapped in a textarea when a form is submitted. |
HTML textarea tag Examples
Example 1: Basic Usage of <textarea>
This simple example illustrates the use of the <textarea> tag in HTML that enables the multi-line text input control.
HTML <!DOCTYPE html> <html> <head> <title>textarea tag</title> </head> <body> <h1>GeeksForGeeks</h1> <h2>HTML Textarea tag </h2> <form action="#"> <textarea rows="10" cols="20" name="blog"> Share your knowledge by writing your own blog! </textarea> <br> <input type="submit" value="submit"> </form> </body> </html>Output:
HTML tag example Output</p>
Example 2: Disabling the Resize Option
In this example, we have used the resize property whose value is set to none that will disable the resize option of the textarea.
HTML <!DOCTYPE html> <html> <head> <title>HTML textarea tag</title> <style> textarea{ resize:none; } </style> </head> <body> <h1>GeeksforGeeks</h1> <h2>HTML Textarea tag </h2> <form action="#"> <textarea rows="7" cols="50" name="comment"> </textarea> <br> <input type="submit"> </form> </body> </html>Output:
HTML Tag
HTML textarea tag Use Cases
1.How to create a text area in HTML ?
To create a text area in HTML, use the <textarea> element with optional attributes like “rows” and “cols” to specify its size and dimensions, respectively.
2.How to set the size of textarea in HTML ?
To set the size of a textarea in HTML, use the “rows” and “cols” attributes within the <textarea> tag, specifying the desired number of rows and columns respectively.
3.How to create a multiline input control text area in HTML5 ?
To create a multiline input control textarea in HTML5, use the <textarea> element and specify the number of rows and columns using the “rows” and “cols” attributes respectively.
Conclusion
The <textarea> tag in HTML is a versatile element for collecting multi-line text inputs from users. By using its various attributes, you can control the size, appearance, and behavior of the textarea to suit your form’s needs. Whether you’re creating a simple comment box or a more complex input field, the <textarea> tag provides the necessary functionality to capture user input effectively.
Supported Browsers
The browser supported by HTML textarea tag are listed below:
- Google Chrome: Version 38 and later
- Firefox: Version 33 and later
- Microsoft Edge: Version 13 and later
- Opera: Version 25 and later
- Safari: Version 9 and later
S
shubham_singh Follow Improve Previous Article HTML <textarea> readonly Attribute Next Article HTML | <textarea> required AttributeSimilar Reads
Which tag is used to represent progress of a task in HTML & how is it different from <meter> tag ? In this article, we will see which tag is used to represent the progress of a task in HTML. To represent the progress of a task, we will use the <progress> tag. This tag is used to represent the progress of a task. It is also defined how much work is done and how much is left. Syntax: <progress attributes...> </progress> Attribute 2 min read Is container tag same as the empty tag in HTML? If not, why ? In this article, we will see the container tag & empty tag in HTML, along with knowing how they're different from each other. The Container tag is not the same as the empty tag & these are two different categories of tags used in HTML. Container tag: This tag contains 3 parts, namely, the opening tag, content that will be displayed in the b 5 min read HTML | DOM Textarea autofocus Property The DOM Textarea autofocus Property is used to set or return whether the element should get focus when the page loads. This property is used to reflect the HTML autofocus attribute. Syntax: It is used to Return the autofocus property. textareaObject.autofocusIt is used to Set the autofocus property. textareaObject.autofocus = true|false Property Va 2 min read HTML DOM textarea minlength Property The HTML DOM textarea minlength property is used to set or return the value of the minlength attribute of a textarea field. It specifies the minimum number of characters that have been allowed in the Element. Syntax: It returns the minLength property. textareaObject.minLengthIt is used to set the minLength property. textareaObject.minLength = numbe 2 min read HTML | DOM Textarea maxlength Property The DOM Textarea maxlength Property is used to set or return the value of the maxlength attribute of a textarea field. It specifies the maximum number of characters that have been allowed in the Element. Syntax: It is used to return the maxLength property: textareaObject.maxLength It is used to set the maxLength property: textareaObject.maxLength = 2 min read HTML <textarea> disabled Attribute The disabled attribute for <textarea> element in HTML is used to specify that the text area element is disabled. A disabled text area is un-clickable and unusable. It is a boolean attribute. Syntax: <textarea disabled>text content...</textarea> Example: C/C++ Code <!DOCTYPE html> <html> <head 1 min read HTML DOM Textarea cols Property The DOM Textarea cols Property is used to set or return the value of the cols attribute of a textarea field. The cols attribute how many average-width characters should fit on a single line. Syntax: It is used to return the cols property.textareaObject.colsIt is used to Set the cols property:textareaObject.cols = number Property Values: number: It 2 min read HTML DOM Textarea select() Method The select() method in HTML DOM is used to select the entire content of the text area or in a <input> element that includes a text field. Syntax: textareaObject.select() Parameters: This method does not accept any parameters. Return Value: It does not return any value. Example: In this example, we will see the use of the select() method C/C++ 1 min read HTML | DOM Textarea Object The Textarea Object in HTML DOM is used to represent the HTML <textarea> Element. The textarea element can be accessed by using getElementById() method.Syntax: document.getElementById("ID"); Where ID is assigned to the <textarea> element.Property Values: autofocus: It is used to set or return whether the element should get focus when th 3 min read HTML DOM Textarea disabled Property The DOM Textarea disabled Property is used to set or return whether the textarea element would be disabled or not. A disabled text area is un-clickable and unusable. It is a boolean attribute and is used to reflect the HTML Disabled attribute. Syntax: It is used to return the disabled property.textareaObject.disabledIt is used to set the disabled p 2 min read HTML | DOM Textarea placeholder Property The DOM Textarea placeHolder Property is used to set or return the value of the placeholder attribute of a textarea field. It specifies a short hint that describes the expected value of an input field / textarea. A short message or hint displayed before entering value in textarea. Syntax: It is used to Return the placeholder property. textareaObjec 2 min read HTML | DOM Textarea rows Property The DOM Textarea rows Property is used to set or return the value of a rows attribute of a textarea field. The rows attribute specifies the number of visible text lines for the control i.e the number of rows to display. Syntax: It is used to Return the rows property:textareaObject.rowsIt is used to Set the rows property:textareaObject.rows = number 2 min read HTML | DOM Textarea required Property The DOM Textarea required Property is used to set or return the Whether that the input element must be filled out before submitting the Form. This Property is used to reflect the HTML required attribute.Syntax: It is used to Return the required property: textareaObject.requiredIt is used to Set the required property: textareaObject.required = true| 2 min read HTML | DOM Textarea wrap Property The DOM Textarea wrap Property is used to set or return the value of the wrap attribute of the textarea. It describes the way the text to be wrapped while submitting a form. Syntax: It is used to return the wrap property.textareaObject.wrapIt is used to set the wrap property.textareaObject.wrap = soft|hard Property Values: soft: It defines that the 2 min read HTML | DOM Textarea readOnly Property The DOM Textarea readOnly Property is used to set or return that the text in the textarea should be readOnly or not. If it is readOnly then the content cannot be modified but it can be copied.Syntax: It is used to return the readOnly property.textareaObject.readOnlyIt is used to set the readOnly property.textareaObject.readOnly = true|false Propert 2 min read HTML | DOM Textarea name Property The DOM Textarea name Property is used to set or return the value of the name attribute of a textarea field. Syntax: It is used to return the name property.textareaObject.nameIt is used to set the name property:textareaObject.name = text/value Property Values: text: It specifies the name of the text area. Return Value: It returns the name of the te 2 min read HTML | DOM Textarea defaultValue property The DOM Textarea defaultValue Property is used to set or return the default value of the textarea field. Syntax: It is used to return the defaultValue property.textareaObject.defaultValueIt is used to set the defaultValue property:textareaObject.defaultValue = text/value Property Values: text: It specifies the default value of the text area. Return 2 min read HTML | DOM Textarea form Property The DOM Textarea form Property is used to return the text area by reference to the form that contains that text area. It returns the form object if the code successfully runs or if the text area is in the form.Syntax: textareaObject.form Return Value: If text area is not contained in the form then it returns the reference of the form that contains 2 min read HTML | <textarea> placeholder Attribute The <textarea> placeholder attribute in HTML is used to specify the expected value to be displayed before user input in textarea element. Syntax: <textarea placeholder="text"> Attribute Value: This attribute contains single value text which is the initial string to be displayed before user input. Example 1: This example uses <textare 2 min read HTML <textarea> autofocus Attribute The HTML <textarea> autofocus Attribute is used to specify that the textarea field should get automatically focus when the page loads. It is a Boolean Attribute. Syntax: <textarea autofocus> Example: This Example illustrates the use of autofocus attribute in Textarea Element. C/C++ Code <!DOCTYPE html> <html> <head> 1 min read HTML | <textarea> cols Attribute The HTML <textarea> cols Attribute is used to tell the browser how many average-width characters should fit on a single line i.e the number of columns to display. It is used to specify the visible width of the <Textarea> Element. Syntax: <textarea cols="number"> Attribute Values: It contains the value i.e number which specifies th 1 min read HTML | <textarea> required Attribute The HTML <textarea> required Attribute is a Boolean attribute which is used to specify that the <textarea> element must be filled out before submitting the Form. Syntax: <textarea required> Example: This Example illustrates the use of required attribute in Textarea Element. C/C++ Code <!DOCTYPE html> <html 1 min read HTML | <textarea> wrap Attribute The HTML textarea wrap Attribute is used to specify that in which manner the text is to be wrapped in a text area when a form is submitted. Syntax: <textarea wrap="soft|hard"> Attribute Values: soft: It specifies that the Text present in the Textarea would not be wrapped after submitting the form. This is the default value.Hard: It specifies 1 min read HTML | <textarea> name Attribute The HTML <textarea> name Attribute is used to specify a name of the <Textarea> Element. It is used to reference the form-data after submitting the form or to reference the element in a JavaScript. Syntax: <Textarea name="text"> Attribute Values: It contains the value i.e name which specify the name for the <Textarea> element 1 min read HTML | <textarea> form Attribute The HTML <textarea> form Attribute is used to specify the one or more forms that the <Textarea> element belongs to.Syntax: <Textarea form="form_id"> Attribute Values: form_id: It Contains the value i.e form_id which specify the one or more form that the Textarea element belongs to. The value of this attribute should be id of the 1 min read HTML | <textarea> rows Attribute The HTML textarea rows Attribute is used to specify the number of visible text lines for the control i.e the number of rows to display. It also specifies the visible height of the Textarea. Syntax: <textarea rows = "value"> Attribute Values: number: It specify the height of the Textarea. Its Default value is 2. Example: C/C++ Code <!DO 1 min read HTML | <textarea> dirname Attribute The HTML <textarea> dirname Attribute is used to enable the text direction of the Textarea Field after submitting the form. The value of the dirname attribute must be the name of the input field and textarea, followed by “.dir”. Syntax: <textarea name="myname" dirname="myname.dir"></textarea> Attribute Values: dir.nameIt specify t 1 min read HTML | DOM Textarea autocomplete Property The textarea autocomplete property in HTML DOM is used to set or return the value of the autocomplete attribute of a textarea field. The autocomplete attribute is used to specify whether the autocomplete attribute has “on” or “off” value. When the autocomplete attribute is set to on, the browser will automatically complete the values based on which 2 min read HTML | <textarea> dirname Attribute The HTML <textarea> dirname attribute is used to enable the text direction of the input and the Textarea Field after submitting the form. The value of the dirname attribute must be the name of the input field and textarea, followed by ".dir". Syntax: <textarea name="myname" dirname="myname.dir"> Attribute Values: name.dir: It specifies 1 min read HTML | <Textarea> minlength Attribute The HTML <Textarea> minlength Attribute is used to define the minimum number of characters (as UTF-16 code units) of a Textarea Element. The Integer value must start with 0 or higher. Syntax: <Textarea minlength="numeric"> Attribute Value: number: It contains the numeric value i.e 0 or higher. Example: C/C++ Code <!DOCTYPE html> 1 min read Article Tags :- HTML
- Web Technologies
- HTML-Tags
What kind of Experience do you want to share?
Interview Experiences Admission Experiences Career Journeys Work Experiences Campus Experiences Competitive Exam ExperiencesTừ khóa » Html5 Textarea Alternative
-
Alternative To TextArea With More Control Over Text? - Stack Overflow
-
The Textarea Element - HTML: HyperText Markup Language | MDN
-
HTML Textarea Tag - W3Schools
-
Modern Approach To Textarea (or Alternatives) - UX Stack Exchange
-
Text Area Resize Alternative Code Example
-
HTML5 Textarea Attributes: Here's What You Should Know »
-
Alternative Text Box Fields And Textarea In A Web Form - YouTube
-
7 Ways To Enhance The HTML TextArea Element - Love2Dev
-
Contenteditable Textarea Alternative - JSFiddle - Code Playground
-
HTML - Textarea Tag - Tutorialspoint
-
HTML Textarea Tag - Tutorial Republic
-
Textarea Tricks | CSS-Tricks
-
HTML Textarea - Javatpoint
-
HTML