JSFiddle - React, Tailwind, and code Playground

HTML

<html>
  <head>
    <script>

      var checkTf = function(){

        let charcode_max = 255;

        let tf = document.getElementById("tf");

        for(let i = tf.value.length-1; i >= 0; i--){
          if(tf.value[i].charCodeAt(0) > charcode_max){
            tf.value = tf.value.substr(0,i) + tf.value.substr(i+1);
          }
        }

      }

    </script>
  </head>
  <body>
    <textarea id="tf" oninput="checkTf()"></textarea>
  </body>
</html>