JSFiddle - React, Tailwind, and code Playground
HTML
<div id="main">
<button type="button" id="clck" onclick="javascript:popup();">Clicky?</button>
</div>
<div id="alertContainer">
<div id="alertContent">
<p>
I fight dragons with tooth picks. Rawrr!
</p>
<span id="close">×</span>
</div>
</div>
<script>
var popupBox = document.getElementById('alertContainer');
var x = document.getElementById('close');
function popup(){
popupBox.className = popupBox.className + 'show';
}
</script>
CSS
#main {
width: 98vw;
height: 97vh;
background-color: #1abc9c;
}
#clck {
margin-top: 15vh;
margin-left: 20vw;
height: 40px;
width: 90px;
border-style: none;
background-color: #2ecc71;
color: #fff;
}
#clck:hover{
background-color: #9b59b6;
}
#clck:focus {
outline: none;
}
#alertContainer {
position: absolute;
display: none;
width: 350px;
height: 200px;
top: 35%;
left: 30%;
background-color: #e67e22;
color: #fff;
text-align: center;
line-height: 100px;
}
#alertContainer.show {
display: block;
}
#close {
font-size: 2em;
}
#close:hover {
color: #9b59b6;
cursor: pointer;
}
JavaScript
$('#close').click(function() {
popupBox.className = "";
});