const btnMail = document.querySelector("#mail-button")
const popupForm = document.querySelector("#popup-Form")
const btnCancel = document.querySelector("#btn_cancel")
const openform = () => {
    btnMail.addEventListener('click', () => {
        popupForm.style.display="block"
    })
}
openform()
const closeform = () => {
    btnCancel.addEventListener('click', (e) => {
        e.preventDefault()
        popupForm.style.display="none"
    })
}
closeform()
Hi, I made two functions to open the form popup with one button and close it with another button I want to make a new function when the user click outside the form popup for close the form popup, I tried the method target but it didn't work. What javascript method can I use to achieve this? Thanks you
