JSFiddle - React, Tailwind, and code Playground
by huuzoo
HTML
<input type="text" id="form" onchange="errorCheck()">
<p id="errorText"></p>
JavaScript
function errorCheck() {
var form = document.getElementById('form');
if ( form.value.length > 3 ) {
form.value = '';
document.getElementById('errorText').innerHTML = '3文字以内で入力してください。';
}
}