VBdotnet2005
asked on
character remaining count
I want to display character remaining count when a user start typing. lblcommentscount is displayed 512 when txtbox is empty. How can I prevent this? Instead it should be displayed only when a user start typing.
<script type="text/javascript">
function countCharacters(textbox, label, maxcount) {
var count = parseInt(document.getElementById(textbox).value.length);
document.getElementById(label).innerHTML = maxcount - count;
}
txtcomments.Attributes.Add("onKeyUp", String.Format("countCharacters('{0}','{1}', 512) ", txtcomments.ClientID, lblcommentscount.ClientID))
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.