Lesson Code: http://www.developphp.com/video/JavaScript/textarea-Form-Field-Character-Counting-and-Limiting
Learn to use Javascript to limit and count a text field in your HTML based forms. Show the user how many characters are remaining that they can type into that field. It will visually limit the amount they can type in real time also.
Original source
24 responses to “Javascript Tutorial : Textarea Counting and Limiting”
omg adam i love you.u have every tutorial in the world ever <3
Actually i am getting an error that textField(the first argument of textCounter function) is not defined
What if my textbox is not in a form tag ? It is in the div of a certain class. so in the arguments where we have this.form.ta…. what will be the argument ?
Thx a lot for sharing, thumbs up! 🙂
Nice one Adam, God bless you,I've learnt alot from many of your tutorials
Does it have to be a input? Or can it be a Paragraph or heading? Thanks
can you do a tutorial on how to make the containing div expand when you expand a textarea element, so that the textarea doesn't overflow out of the container?
sir, why do we use the "this.form.ta" instead of "document.form.ta"? Both of them are similiar right?
How to restrict the entering of text in the textarea once it has reached its maxAmount?
Can you please explain. Thanks.
You replied to a year old comment, hehe. Now I'm certified in Dreamweaver… 😛 Haven't really made any actual webpage because one, you can't host it for free, and two, I don't know what to do it on! I have an idea now, though. Any recommendations on free hosting?
lol
@gukoshi nm XDDD i found out that I have dreamweavver LOL :3 i forgot abt the adobe package my dad bought me :3
Hello Adam!
I think it is easy to do it in Flash… Could u do a little example??
Thanks!
all the other browsers can suck my nuts, i agree!
@awesomelightning
I have been testing quite a lot of them, and my favorite and daily use is notepad++.
The only thing I miss with that is a snippet-container, the given solution for that is not the best…
@awesomelightning notepad
What is the best free program I can use to create raw html web pages?
Adam?!
I think 130592016 was asking what will happen to the max-length restriction if a user of this form toggles off javascript in his browser….
If so, the correct answer should be:
"If someone disables Javascript in his browser, the counter will not be changing from 250, AND the maximum value WILL be bypassed".
Afaik there is no way to restrict a textarea with a simple html-property.
But thanks Adam for showing this, I was wondering now for a long time how these thingies work…
@130592016 the form field still has text size 250 so ur good…they just wont see whats in the lil text box with the counter if js isnt going
if somoene disable javascript in there browser can they bypass the maximum ?????
Hey Adam….Another nice sweet tut…
Wanted to ask if there is an option to restrict the ability to drag and resize the text area????
way cool
lilorange lol
wow.. nice intro!