Getting “TypeError: Cannot set property 'onclick' of null”
This error indicates that when this code is executed, there is no element rendered in the browser that can be found with the id of menuLink. When you manually execute the statement in the browser console, you're doing so after the entire page has been rendered and menuLink is now in the page context. You will probably…
Answered Aug 17, 2021 · 1.4K Views Read answer →