, , , , , , ,

Oh my god, spend few hours trying to clear ASP.Net TextBoxes using JQuery and yes Done but when it comes with TextMode=”MultiLine” I was searching on net and my head, couldn’t believe it, what’s wrong and then found an Article told me what’s wrong…


<html xmlns=”http://www.w3.org/1999/xhtml”&gt;

<head id=”Head1″ runat=”server”>

<title>Limit Characters in a Multiline TextBox</title>

<script type=’text/javascript’ src=’http://jqueryjs.googlecode.com/files/jquery1.3.2.min.js’></script&gt;

<script type=”text/javascript”>

$(function() {

var limit = 50;

$(‘textarea[id$=tb1]’).keyup(function() {

var len = $(this).val().length;

if (len > limit) {

this.value = this.value.substring(0, limit);


$(‘#spn).text(limit – len + ” characters left”);






<form id=”form1″ runat=”server”>


<asp:TextBox ID=”tb1″ runat=”server” TextMode=”MultiLine”/><br />

<span id=”spn “></span>





The Best Part is Below:

Observe how we are selecting the control using textarea in the code shown above $(‘textarea[id$=tb1]’). This is as the ASP.NET Multiline TextBox renders as a textarea.