Why is this returning null
before returning the actual element?
const subNav = document.querySelector('.subnav-block');
console.log(subNav);
Here's the codepen, lines 30 and 31
Why is this returning null
before returning the actual element?
const subNav = document.querySelector('.subnav-block');
console.log(subNav);
Here's the codepen, lines 30 and 31
The null is logged even before the dom is rendered, hence couldn't find the element.