JSFiddle - React, Tailwind, and code Playground

HTML

<textarea id="myinput"></textarea>
<div id="charcount"></div>

CSS

textarea {
    width:400px;
    height:100px;
}

JavaScript

var charCount = $('#charcount')
$('#myinput').keyup(function () {
    var text = this.value;
    var isChinese = /[^\x00-\x80]+/
    var step = isChinese.test(text) ? 60 : 152;
    charCount.text('We will deduct '+ ~~(1 + ((text.length - 1) / step)) +' credit for this message per contact. Characters: '+text.length);
   
})