Monday, June 2, 2008

Javascript:check length of textarea

function textCounter(field, maxlimit)// check length of textarea
{
if (field.value.length > maxlimit)
field.value = field.value.substring(0,maxlimit);
}

onkeydown="textCounter(this.form.ctl00$ContentPlaceHolder1$txtBrandDescription,2000);"
onkeyup="textCounter(this.form.ctl00$ContentPlaceHolder1$txtBrandDescription,2000);" style="width: 218px"

of TextArea or TextBox

No comments: