JSFiddle - React, Tailwind, and code Playground
by huuzoo
HTML
<input type="text" id="textBox" onkeyup="textCheck()">
<p>文字数:<span id="countArea"></span></p>
JavaScript
function textCheck() {
var textValue = document.getElementById("textBox").value;
var textLength = textValue.length;
document.getElementById("countArea").innerHTML = textLength;
}