Now I'm practicing Javascript and I need some helps from you guys.
https://codepen.io/domrongpon-tanpaibul/pen/YzGyBZq?editors=1111
closeBtn.addEventListener('click', () => {
if (this.dispatchEvent(new CustomEvent('close-dlg', {cancelable: true}))) {
div.style.display = "none";
}
})
I think the solution is to use removeEventLister
but the problem is I need it on anonymous function without assigning function name.
Are there any solutions to solve this?