html popup code code example
Example 1: popup JavaScript code
document.getElementById("open-popup-btn").addEventListener("click",function(){
document.getElementsByClassName("popup")[0].classList.add("active");
});
document.getElementById("dismiss-popup-btn").addEventListener("click",function(){
document.getElementsByClassName("popup")[0].classList.remove("active");
});
Example 2: popup HTML code
<div class="popup center">
<div class="icon">
<i class="fa fa-check"></i>
</div>
<div class="title">
Success!!
</div>
<div class="description">
Lorem ipsum dolor sit amet consectetur adipisicing elit. Alias nihil provident voluptatem nulla placeat
</div>
<div class="dismiss-btn">
<button id="dismiss-popup-btn">
Dismiss
</button>
</div>
</div>
<div class="center">
<button id="open-popup-btn">
Open Popup
</button>
</div>