Translate

In this tutorial, We are showing how to add JavaScript Textarea character counter into the form. Using this, Just you have to add this below code into your page. Keep <script> -- code -- </script> tag into the </head> tag and other form code after body code.

This is the running code you can use it directly into your project or browse into browser. After filling 500 character into the Textarea it will show you the alert type "Textarea value can only be 500 characters in length".


This part is your HTML part which you have to use into <body> </body> tag.

<form name="textcount" id="textcount">
 <textarea cols="60"  rows="12" class="input_field_textarea" id="description" name="description" onkeypress="textareaCounter(this,this.form.textcounter,500);" onblur="textareaCounter(this,this.form.textcounter,500);"></textarea>
 <br/>
 Max length - <input type="text" readonly="readonly" name="textcounter" maxlength="3" size="3" value="500" onblur="textareaCounter(this.form.textcounter,this,500);"> charters are remaining.
</form>

You can also run this in same page. just copy both the written code and copy in same page then run in browser.
If you are still facing any difficulty then feel free to contact us using the contact form or use Facebook page comment.
Don't forget to send feedback Friends.

Happy Coding
Thanks,

0 comments:

Post a Comment

 
Top