JSFiddle - React, Tailwind, and code Playground
HTML
<div>
<input type="text" id="text">
</div>
<input type="submit" id="btn">
JavaScript
document.getElementById("btn").onclick = function()
{
var x = document.getElementById("text").value;
if (x.length > 7 || x.length < 5) {
alert("Слишком длинный или короткий никнейм");
}
}