hi
I used below code to show count of character and message from textbox
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<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) {
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) {
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 i.e I type 85 character in textbox and lblTshE =2 so it will display :
character count: 85
count of message: 2
total message(Lblsum)= 4 -------> LblTshE * count of message
now when I delete charcter from textbox it will count down character count...
i.e I delete character untill 69 so it will display:
chracter count: 69
count of message: 1
total message(Lblsuum)= 4
as you see here it will count down charcter count and count of message but it does,'t count down total message...
can you help me please...
best regards
neda