hi see 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) {
i = $(this).val().length / 70;
$('[id*=Lblsum]').html(i * ($('[Id*=LblTshE]').html()));
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
//i = toPersianNumber(i);
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
i = $(this).val().length / 70;
//i = toPersianNumber(parseInt(i));
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;
$('[id*=Lblsum]').html(i * ($('[Id*=LblTshE]').html()));
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
//i = toPersianNumber(i);
$('[id*=hfMessageCount]').val(i);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}
else {
i = $(this).val().length / 70;
//i = toPersianNumber(parseInt(i));
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 = $("[id*=Txtmatn]").val().length / 70;
$('[id*=Lblsum]').html(Math.floor(msgCount) * (Math.floor($('[Id*=LblTshE]').html())));
//msgCount = toPersianNumber(Math.floor(msgCount));
msgCount = Math.floor(msgCount);
$('[id*=hfLblsum]').val($("[id*=Lblsum]").html());
$('[id*=hfMessageCount]').val(msgCount);
$('.MessageCount').html($('[id*=hfMessageCount]').val());
}, 100);
});
});
</script>
in above code in count of message(.Messagecount) will display count of message
if users typed morethan 70 characters it will display=1 if type morethan 140 it will diplay :2
now I want when user enter first character into textbox it will Count of message:1 when they typed morethan 70 characters it will display :2 and if they typed morethan 140 characters it will display:3 and ....
How I can do it?
Best regards
neda