JSFiddle - React, Tailwind, and code Playground

HTML

<form action="register" method="post">
	<input type="text" name="name" id="name" class="input_class" placeholder="test"/>
        <div id="error_name">Input name!</div>
</form>

CSS

#error_name {
    font-family: Arial;
    color: red;
    display: none;
}

JavaScript

function validation() {
    var name = $("#name").val();
    if (name === '') {
    	$("#error_name").css('display', 'block');
    }
    else
    {
    	$("#error_name").css('display', 'none');
    }
}

$("#name").focusout(function () {
    validation();
});