JSFiddle - React, Tailwind, and code Playground

by Lisa French

HTML

<label>Question: </label><input type = "text" maxlength = "100" name = "question" id = "forms"> <br />

CSS

.red-border{
    border: 1px solid red;
}

JavaScript

$("#forms").change(function()
  {
     var value = $(this).val();
     if(value==="")
     {
          $(this).addClass("red-border");
          $(this).focus();
     }else
     {
          $(this).removeClass("red-border");
     }
  });