I have a label lblCountCharacter
with text "4000" and a textbox txtAddNote
where users can enter text.
On entering one character in txtAddNote
, the label text is decreased by one.
Please help me write a function for this in asp.net using C#.
In order to avoid post backs you can use jQuery to determine the length of the text in the text box:
var myLength = $("#myTextbox").val().length;
I think you can get a better solution to this by using just javascript/jQuery. Using c# is going to involve having to use AJAX to re-render the Label each time.
var characterLimit = 4000
var charLeft = characterLimit - $(".textbox").val().length
$(".label").html(charLeft);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With