How can I make event.target work for not just the div given but also all it's children? The best I can come up with is to either:
1) list all children in the event.target function ie:
window.addEventListener('mouseup', function (event) {
if(event.target != div && event.target != divChild1 && event.target != divChild2 && event.target != divChild3 && event.target != divChild4 && event.target != divChild5 ... && event.target != divChildn) {
closeWindow();
} });
OR
2) put all the children in a class (which seems like an awful lot of html) and then just have event.target refer to that class i.e.:
window.addEventListener('mouseup', function (event) {
if(event.target != classWithAbout50divs) {
closeWindow();
} });
But surely there is a way that requires less code..?
And please, no jquery. Thanks