HTML <Textarea>maxlength attribute


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:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!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

chevron_right


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

full-stack-img




My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.