textarea: limit text input
Written by prettynerd   
Thursday, 11 March 2010 10:00

add this function within the <script> tags of a html source file or add in a .js file:

 

function limitText(limitField,limitNum) {
 if (limitField.value.length > limitNum) {
  limitField.value = limitField.value.substring(0, limitNum);
 }
}

 

then, call the function in the <textarea> onKeyDown and onKeyDown events:

 

<textarea onKeyDown="limitText(this,2000);" onKeyUp="limitText(this,2000);">



Comments (0)

WRITE YOUR COMMENT HERE

Your Contact Details:
Comment:
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):S
Security
Please input the anti-spam code that you can read in the image.
 

Salesforce Certified Administrator

 

Salesforce Certified Developer