JSFiddle - React, Tailwind, and code Playground
HTML
<textarea id="txtTest" maxlength="510" rows="3" cols="50"></textarea>
<button id="btnjqCount">jqCount</button>
<button id="btnjsCount">jsCount</button>
<div id="out"></div>
JavaScript
var $out = $("#out");
$("#btnjqCount").click(function(evt){
$out.append("jqCount counts: " + $("#txtTest").val().length + "<br/>\n");
});
$("#btnjsCount").click(function(evt){
var testTextArea = document.getElementById("txtTest");
var testText = testTextArea.value;
$out.append("jsCount counts: " + testText.length + "<br/>\n");
});
$("#txtTest").on("keyup",function(evt){
$out.append("txtTest counting: " + $(this).val().length + "<br/>\n");
});