You must Sign In to post a response.
  • Category: HTML

    Text Area maximum length

    How to maxlength in Html Textarea control. Below code is not working. Please assist.

    <textarea maxlength="50">
    Enter text here...
  • #736113
    Hi Bujji,

    Try this one.. It may help u

    <H1> This is for creating the maximum lenght of textarea in HTML </H1>
    <textarea rows="4" cols="50" maxlength="50">
    Enter Your text Here </textarea>


  • #736124
    'maxlength' in textarea is introduced newly in HTML5 it is not exist in HTML 4 that is regular html it is not exist. you need to take help of javascript to check the length of textarea
    see below code snippet

    <script language="Javascript">
    function checkLength()
    if(document.getElementById("txtArea").value.length > 50)
    alert('Please insert only 50 characters');
    return false;
    //call above function on Textarea onkeypress
    <Textarea cols="3" rows="3" onkeypress="return checkLength();">

    hope it helps

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

  • #736129
    hey, check this example it will help you,


  • #736131
    What is the problem you are having.

    <textarea maxlength='250' name=''>\
    ur value here


    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM

  • #736171

    Your code works fine if you are using internet explorer 10 or above.

    maxlength attribute of the textarea is introduced recently so it is not advisable to use this feature at this time as many people still uses IE 8 or 9.

    Asheej T K

  • #736363

    <form action="demo_form.asp">
    Enter Text: <input type="text" name="mytext" maxlength="50"><br>
    <input type="submit" value="Submit">


    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #744517

    Set Text Area maximum length--

    <!DOCTYPE html>

    <textarea rows="4" cols="50" maxlength="10">
    Enter text here...</textarea>



    Dipti Choudhari

  • Sign In to post your comments