I want to make a popup that should appear once a button is clicked and disappear once the user clicks outside of the box.
I\'m not sure how to make the div disappear
Here is my Solution.
yourFunc=e=>{ var popbox = document.getElementById("popbox"); if(e.target.id !=="popbox"){ popbox.style.display = "none"; }else{ popbox.style.display = "block"; } } document.addEventListener("click",yourFunc)