JSFiddle - React, Tailwind, and code Playground

by Joe

HTML

<textarea name="" rows="4" cols="24" maxlength="1000" id="joe" placeholder="Message:" style=""></textarea><br/>
<span id="charNum"></span>

JavaScript

$('#joe').keyup(function () {
  max = this.getAttribute("maxlength");
  var len = $(this).val().length;
  if (len >= max) {
    $('#charNum').text(' you have reached the limit');
  } else {
    var char = max - len;
    $('#charNum').text(char + ' characters left');
  }
});