Wednesday, 21 January 2015

How to Count the Characters in JavaScript

<script type="text/javascript">
function CharactersCount()
{
     var CharLength = '<%=ID.MaxLength %>';
     var txtMsg = document.getElementById("<%= ID .ClientID%>");
     if ( ID  .value.length > CharLength) {
     ID.value =  ID.value.substring(0, CharLength);
     }
     }

 </script>

No comments:

Post a Comment