JSFiddle - React, Tailwind, and code Playground
by jefferyto
HTML
<textarea id="text"></textarea>
<div id="count"></div>
JavaScript
$('#text').keyup(function() {
var text = $(this).val(),
count = encodeURIComponent(text).replace(/%[A-F\d]{2}/g, 'U').length;
$('#count').text(count);
}).keyup(); // trigger the handler once during init to update count