Just replace your javascript code with this.
<script language="javascript" type="text/javascript">
function DisplayCount() {
var length = document.getElementById('<%=txtSignature.ClientID%>').value.length;
document.getElementById('<%=lblCharacters.ClientID%>').innerText = length;
alert(length);
}
</script>
1) Replace
D with
d in
document.getElementByID
. It should be
document.getElementById
2) For label you have to use
innerText
to set the value.
And in page load also change the code like this.
txtSignature.Attributes.Add("onkeypress", "javascript:return DisplayCount();");
Only
keypress
or
keydown
is enough.