JSFiddle - React, Tailwind, and code Playground

HTML

<div id="box" align="center">
 </div>
 <form>User Name:
        <input type="text" name="firstname" />
        <br/>Password:
        <input type="password" name="pwd" />
        <input type="submit" />
        <button type="button" id="cancel">Cancel</button>
    </form>
<a id="login" href="#">Click to Login</a><br/>

<a id="alert" href="#">Click To Alert before and after opening form</a>

CSS

div {
    
    width: 100%;
    height: 100%;
    display:none;
    position: absolute;
    z-index:100;
    background: lightgreen;
    opacity: 0.6;
}

form{
    position: absolute;
    z-index: 101;
    display:none;
    width: 200px;
    border: 2px solid red;
    margin-top:50px;
    margin-left: 200px;
    background: cornflowerblue;
   
}

JavaScript

$('#alert').click(function(){alert('alert')})


$('a#login').click(function(){
 $("#box").fadeIn('slow');
    $('form').fadeIn('slow');
    
})

$('#cancel').click(function(){
$('#box,form').hide();
    
})