hi refer below threads
http://www.aspforums.net/Threads/149477/how-to-count-of-message-from-textbox/?p=1
I wrote below code:
<script type="text/javascript">
$(function () {
var i = 0;
$('[id*=Txtmatn]').keydown(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=hfCharacterCount]').val($(this).val().length);
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($(this).val());
if ($(this).val().length % 70 == 0 && $(this).val().length != 0) {
i = $(this).val().length / 70;
i = i + 1;
$('[id*=Lblsum]').html(i * ($('[Id*=LblTshE]').html()));
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
if ($(this).val().length == 0) {
i = 0;
}
else {
i = $(this).val().length / 70;
i = i + 1;
i = parseInt(i);
}
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
}
});
$('[id*=Txtmatn]').keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=hfCharacterCount]').val($(this).val().length);
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($(this).val());
if ($(this).val().length % 70 == 0 && $(this).val().length != 0) {
i = $(this).val().length / 70;
i = i + 1;
$('[id*=Lblsum]').html(i * ($('[Id*=LblTshE]').html()));
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
if ($(this).val().length == 0) {
i = 0;
}
else {
i = $(this).val().length / 70;
i = i + 1;
i = parseInt(i);
}
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
}
});
$("[id*=Txtmatn]").bind('paste', function (e) {
setTimeout(function () {
$('[id*=hfCharacterCount]').val($("[id*=Txtmatn]").val().length);
$('[id*=LbltedaCh]').html($('[id*=hfCharacterCount]').val());
$('[id*=hfTextBoxValue]').val($("[id*=Txtmatn]").val());
var msgCount = "";
if ($("[id*=Txtmatn]").val().length != 0) {
msgCount = $("[id*=Txtmatn]").val().length / 70;
msgCount = msgCount + 1;
}
else {
msgCount = 0;
}
$('[id*=Lblsum]').html(Math.floor(msgCount) * (Math.floor($('[Id*=LblTshE]').html())));
msgCount = Math.floor(msgCount);
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
$('[id*=hfMessageCount]').val(msgCount);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}, 100);
});
});
</script>
here in below line it will (count of message * LblTshE )
$('[id*=Lblsum]').html(i * ($('[Id*=LblTshE]').html()));
now problem is when I typed text into textbox it doesn't show Lblsum value untile I typed 70 characters after that it will display number into Lblsum
Best regards
neda