JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" name="phone" id="phone">
CSS
#phone.error{
border: 1px solid red;
}
#phone.error:after{
content:'Введите телефон';
display: block;
color:red;
font-size:12px;
}
JavaScript
$('input[name="phone"]').bind('focusout', function(){
if($(this).val().length === 0){
$(this).addClass('error');
return false;
}else{
$(this).removeClass('error');
return true;
}
});