Make sure the
DOM
contains the
div
element with the class
overlay
Quote:
Uncaught typeerror: cannot read property 'queryselector' of null
You will get this error, when you try to access the members of an object which is
null
, Validate for
null
values before accessing the
members
overlay = document.querySelector('div.overlay'),
if(overlay != null){
closeBttn = overlay.querySelector('button.overlay-close');