JSFiddle - React, Tailwind, and code Playground
HTML
<p>Maximum Number of characters for this text box is 255.</p>
<textarea data-counter="myCounter" id="Description" rows="7" wrap="physical" cols="40" maxlength="255">
</textarea>
<p>You have <b><span id="myCounter">255</span></b> characters remaining for your description...</p>
JavaScript
var txtArea = document.getElementById('Description');
txtArea.counter = document.getElementById(txtArea.getAttribute('data-counter'));
txtArea.onkeyup = txtArea.onchange = txtArea.oninput = taLimit;
function taLimit() {
var maxL = this.getAttribute('maxlength');
if (this.value.length>=maxL){
this.value = this.value.substring(0, maxL);
}
this.counter.innerHTML = maxL-this.value.length;
}