JSFiddle - React, Tailwind, and code Playground
HTML
<div class="input-box">
<label for="name">Your name <span class="required-star">*</span></label>
<input type="text" name="name" id="name" placeholder="Your name" class="input-error" required></input>
<div class="msg">Tohle je chyba kámo!</div>
</div>
<div class="input-box">
<label for="name">Your name <span class="required-star">*</span></label>
<input type="text" name="name" id="name" placeholder="Your name" class="input-error" required></input>
<div class="msg">Tohle je další chyba kámo!</div>
</div>
<div class="input-box">
<label for="name">Your name <span class="required-star">*</span></label>
<input type="text" name="name" id="name" placeholder="Your name" class="input-error" required></input>
<div class="msg">A zase chyba kámo!</div>
</div>
CSS
.input-box {
position:relative;
margin: 15px 0 0 0;
border: solid 0px #000;
width:530px;
}
.msg{
display:none;
position:absolute;
top:0;
right:0;
padding:10px;
background:#ccc;
}
label {
display: inline-block;
margin: 0 0 5px 0;
font-weight: bold;
}
label .required-star{
font-weight: normal;
color: #cc0000;
}
input[type="text"],
input[type="email"],
input[type="password"] {
display: block;
width: 500px;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857;
color: #666;
vertical-align: middle;
background-image: none;
border: 1px solid #e1e1e1;
border-radius: 5px;
}
.msg{
position: absolute;
right:0;
}
JavaScript
//SHOW INPUT TOOLTOP FOR VALIDATION FORM
$(".input-error").bind("mousemove", function(event) {
$(this).next().fadeIn("fast");
}).bind("mouseout", function() {
$(this).next().fadeOut("fast");
});