Introduction:
In this article going to see about to display remaining
character count in multiline textbox…
Normally this method used to display the remaining character
user can able to enter in the textbox…
By limit to certain limit length, total length used to
display using this method……
Java script Code:
<script type="text/javascript" language="Javascript">
function textCounter(field, countfield,
maxlimit) {
if
(field.value.length > maxlimit)
field.value =
field.value.substring(0, maxlimit);
else
countfield.value="charactes left ";
countfield.value +=maxlimit -
field.value.length;
}
</script>
|
<div>
<asp:TextBox ID="TextBox1" runat="server" Height="100" Width="550" Wrap="true"
TextMode="MultiLine" onkeyup="textCounter(TextBox1, TextBox2,
50);"
onkeydown="textCounter(TextBox1,TextBox2, 50);" />
</div>
<div>
<asp:TextBox ID="TextBox2"
runat="server" style="color :Red;" ></asp:TextBox>
</div>
|
I hope you like these easy methods to display character
count…
Post your comments here…
0 comments:
Post a Comment