ASP.NET - How to Count Character written in TextBox ?
For that follow give procedure in visual studio
- Textbox (to write string / characters)
- Label (To print total character printed at textbox)
<head runat="server"> <title>Remaining Characters Counter</title> <script type="text/javascript"> function Count() { var i = document.getElementById("TextBox1").value.length; document.getElementById("Label1").innerHTML = 10 - i; } </script> </head>
5 . Write Event name of Textbox already you have taken in form
Ex : - onkeyup='(your event name)'
6 . Call this function
<asp:TextBox ID="TextBox1" runat="server" MaxLength="10" onkeyup="Count()"> </asp:TextBox>
Great you did it ......
Thanks for reading my article
Keep tune in to get latest articles ......