tags:

views:

136

answers:

3

I have a multiline textbox which can contain only 500 characters. Now i want to show the user the number of characters left as they are typing into the textbox as is the case when we use twitter.

Kindly help

+5  A: 

Take a look at this JQuery script: http://pure-essence.net/stuff/webTips/dodosTextCounter/index.html

meep
i am not familiar with JQuery so do i have to add something to my project to run the JQuery script. Does all browsers support it ?
HotTester
The vast majority of browsers in use are supported by it. You need to include the JQuery script from your page.http://jquery.com/
Turnkey
The example given uses the html controls. How to do it with asp.net controls ?
HotTester
It's 2010, avoid custom javascript like the plague. Base your scripts on a framework that is proven like JQuery.
Chris Marisic
+2  A: 

See ASP.NET Text Character Counter by Ross Hawkins.

KMan
A: 

You'll have to write some js code.

here is simple snipptet:

<html><form name="form1"><input type="text" name="textArea" size="400" onkeyup="document.form1.count_display.value=document.form1.textArea.value.length;"><br/><input type="text" name="count_display"></form></body></html>

you can change the calculation to show the characters left, or the already typed count, as you need

Tamir
Thanks for the code but the textbox is asp.net control not html control.
HotTester
of course. It was only for the sample. you can paste the client events, it will work the same
Tamir