function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
function closeModalOnClickOutside(){
if (!event.target.closest('#myDIV') && !event.target.closest('#myLink') && document.getElementById("myDIV").style.display !== "none") {
console.log('close');
window.removeEventListener('mousedown', closeModalOnClickOutside);
document.getElementById("myDIV").style.display = "none";
}
}
window.addEventListener('mousedown', closeModalOnClickOutside);
x.style.display = "block";
} else {
x.style.display = "none";
}
}
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
function closeModalOnClickOutside(){
if (!event.target.closest('#myDIV') && document.getElementById("myDIV").style.display !== "none") {
document.getElementById("myDIV").style.display = "none";
window.removeEventListener('mousedown', closeModalOnClickOutside);
}
}
window.addEventListener('mousedown', closeModalOnClickOutside);
x.style.display = "block";
} else {
x.style.display = "none";
}
}
function myFunction() {
var x = document.getElementById("myDIV");
if (x.style.display === "none") {
x.style.display = "block";
function closeModalOnClickOutside(){
if (!event.target.closest('#myDIV')) {
document.getElementById("myDIV").style.display = "none";
window.removeEventListener('click', closeModalOnClickOutside);
}
}
window.addEventListener('click', closeModalOnClickOutside);
} else {
x.style.display = "none";
}
}