Javascript Function:
function ValidateTA(obj)
{
var str = new String(obj.value);
if(str.length >= 10)// Here the Max char is 10
{
window.event.returnValue = 0;
}
}
HTML Control:
textarea id="TextArea1" onkeydown="ValidateTA(this)" cols="20" rows="2"
Note: We can implement the same logic for the requiremens like, "only char should be entered or Only numbers should be entered in a text box"
No comments:
Post a Comment