[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Text Area Max Length Counter

Posted on 2004-11-29
3
Medium Priority
?
318 Views
Last Modified: 2013-12-24
Does anyone have any code for a counter that sits below a textarea and increments every time the user inputs characters in the text area ?

for Example...

Text Area

fhfhfhfhfhfhfhfhfhfhfhfhfhfhfh

30 / 250 Characters

Thanks

Jonathan
0
Comment
Question by:jturkington
3 Comments
 
LVL 5

Accepted Solution

by:
kkhipple earned 1000 total points
ID: 12696406
this is what you are looking for ... enjoy
 

http://javascript.internet.com/forms/limit-textarea.html
0
 
LVL 14

Assisted Solution

by:Renante Entera
Renante Entera earned 1000 total points
ID: 12702364
Hello jturkington!

Try to run this code :

<script language="JavaScript">
function textCounter(field, countfield, maxlimit)
{
  if (field.value.length > maxlimit)
    field.value = field.value.substring(0, maxlimit);
  else
    countfield.value = field.value.length;
}
</script>

<cfparam name="maxlength" default="250">

<cfoutput>
<form name="form1">
  Remarks :
  <br>
  <textarea name="message" onKeyDown="textCounter(this.form.message,this.form.txtlength,#maxlength#);" onKeyUp="textCounter(this.form.message,this.form.txtlength,#maxlength#);"></textarea>
  <br>
  <input readonly type="text" name="txtlength" size="3" value="0"> / #maxlength# CHARACTERS
</form>
</cfoutput>

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0
 

Author Comment

by:jturkington
ID: 12734082
Thanks guys
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is a guide to setting up a new WHM/cPanel Server to be used for web hosting accounts. It is intended for web hosting company administrators and dedicated server owners. For under $99 per month (considering normal rate of Big Data Cetnters like …
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question