Skip navigation

Note few points regarding <textarea>

  • Initial value must be enclused between <textarea> and </textarea>.
  • maximum number of characters not allowed.

i.e., it is wrong to use. Strict xhtml validation will fail because of maxlength.
<textarea rows=”3′ cols=”20″ maxlength=”150″ />

if not worried about validation, then add maxlength property and call onkeypress as follows
<textarea rows=”10” cols=”25” maxlength=”150” onkeypress=”return TextUtil.isNotMax(this)”></textarea>

var TextUtil = new Object();
TextUtil.isNotMax = function(oTextArea) {
return oTextArea.value.length != oTextArea.getAttribute(“maxlength”);

Now you got maxlength property to textarea. hurray!!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: