aspdotnet-suresh offers articles and tutorials,csharp dot net, articles and tutorials,VB.NET Articles,Gridview articles,code examples of 2.0 /3.5,AJAX,SQL Server Articles,examples of .net technologies

jQuery Set Maximum Length to Textarea or jQuery Check Textarea Maxlength

Dec 18, 2013

Here I will explain how to set maximum length of textarea in
jQuery or check maximum length of textarea in jQuery.
In previous articles I explained jQuery disable right click on images, jQuery expand textbox on focus ,
jQuery slideup slidedown slidetoggle example, jQuery fadein or fadeout example, jQuery create rounded corners for textbox, jQuery show time in webpage and many articles relating to JQuery. Now I will explain how to check maxmimum length of textarea in jQuery.

To implement this we need to write the code like as shown below

<html xmlns="">
<title>jQuery Check count of textarea</title>
<script type="text/javascript" src="">
<script type="text/javascript">
$(function() {
$('#btnCheck').click(function() {
var txt = $('#txtdesc').val();
if (txt.length > 50) {
alert('Please enter less than 50 characters')
<b>Enter Text:</b>
<textarea cols="20" id="txtdesc" rows="2" ></textarea>
<td> <input type="button" id="btnCheck" value="Check Length" /> </td>


Enter Text:

If you enjoyed this post, please support the blog below. It's FREE!

Get the latest,, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email.

subscribe by rss Subscribe by RSS subscribe by email Subscribe by Email


Anonymous said...

great man!!!!!!

Unknown said...

This is very basic right?, instead of if this we can achieve throw textbox keypress event that would be professional manner, :) suggestion

Give your Valuable Comments

Note: Only a member of this blog may post a comment.

© 2015 All Rights Reserved.
The content is copyrighted to Suresh Dasari and may not be reproduced on other websites without permission from the owner.