JSFiddle - React, Tailwind, and code Playground

by Ehsan Sajjad

HTML

<form action=""> 
<input id ="name1" type="textbox"></input>
<input id ="name2" type="textbox"></input>
<input id ="name3" type="textbox"></input>

<input type="button" value="submit"></input>


</form>

JavaScript

$(document).ready(function() {
$("#name1").on('focus',function(){
if ($(this).val() === "")
{
$(this).css({
"border": "1px solid red"
});
}
});

$("#name1").on('blur',function(){

if ($("#name1").val() != "")
$(this).css({
"border-color": "red"
});


});
});