JSFiddle - React, Tailwind, and code Playground

by Prasad

HTML

<html>
    <body>
        <form name="login" id="myform" method="post">
            <input type="text" name="uname" id="nrm">
            <input type="password" name="password" id="nrm">
            <input type="submit" value="submit">
        </form>
    </body>
</html>

CSS

#nrm input
{
    border:1px solid blue;
}
#nrm_miss input
{
    border:1px solid red;
}
#nrm_pass input
{
    border:1px solid green;
}

JavaScript

$("#myform").submit(function(){
    /*var emp=true;
    if("#myform : input").each(function(){
      if($(this).val() === "")            
        {
            $(this).attr('id','nrm_miss');
            alert("empty found");
        }
        else
        {
            $(this).attr('id','nrm_pass');
            emp=true;
        }
    }*/
     /*  alert("submitted");*/
    
});