JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <div id="alert">
        I am an alert box
        <span id="alertClose">X</span>
    </div>
    
    <div id="content">
        Content
        <span id="alertShow">Show Alert Box</span>
    </div>
</body>

CSS

#alert {
    border:1px solid #000;
    display:none;
    position:fixed;
    top: 50%;
    left: 50%;
    margin-top: -50px;
    margin-left: -100px;
    height:100px;
    width:200px;
}
.back {
    opacity:0.5;
}

JavaScript

$(document).ready(function () {
    function showAlertBox() {
        $("#alert").css("display", "inherit");
        $("#content").addClass("back");
        return false;
    }

    function removeAlertBox() {
        $("#alert").css("display", "none");
        $("#content").removeClass("back");
        return false;
    }

    $("#alertClose").click(removeAlertBox);
    $("#alertShow").click(showAlertBox);
    $('#alert').click(false);
    $(document).click(removeAlertBox);
});