The Wayback Machine - https://web.archive.org/web/20210927023305/https://www.geeksforgeeks.org/html-textareamaxlength-attribute/
Skip to content
Related Articles

Related Articles

Improve Article

HTML <Textarea>maxlength attribute

  • Last Updated : 09 Jan, 2020


The HTML <Textarea>maxlength attribute is used to specify the maximum number of characters enters into the Textarea element.

Syntax:

<Textarea maxlength ="number">

Attribute Value:

    number: It contains single value number which allows the maximum number of character in Textarea element. Its default value is 524288.

Example:




<!DOCTYPE html> 
<html> 
  
<head> 
    <title>Textarea maxlength Attribute</title> 
    <style> 
    } 
    fieldset { 
        width: 50%; 
        margin-left: 22%; 
    } 
    h1 { 
        color: green; 
    } 
    </style> 
</head> 
  
<body> 
    <center> 
        <h1>GeeksforGeeks</h1> 
        <h2>Textarea maxlength Attribute</h2> 
        <textarea form="mygeeks"  maxlength="9"> 
        </textarea> 
        <br> 
        <form id="mygeeks"> 
            Name: 
            <input type="text" name="usrname"> 
            <input type="submit"> 
        </form> 
    </center> 
</body> 
  
</html> 

Output:

Supported Browsers: The browsers supported by HTML <Textarea>maxlength attribute are listed below:

  • Google Chrome
  • Internet Explorer 10.0 +
  • Firefox 4.0
  • Opera 15.0
  • Safari

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.




My Personal Notes arrow_drop_up
Recommended Articles
Page :