Haneef Puttur

Limit the Number of Characters in a Textarea or Text Field

This script allows you to set a limit on the number of characters a user can enter into a textarea or text field, like so:

Step 1 – Create Function

Insert the following code into the page head:

 

Step 2 - Create Text Area

Use the following code to create the form and text area (if necessary, change the name of the form and text area to suit your needs):

onKeyUp="limitText(this.form.limitedtextarea,this.form.countdown,100);">


(Maximum characters: 100)

You have  characters left.

 

 

.

Exit mobile version