0
Whatâs wrong with the code ?
Iâm trying to click on the hamburger (parent div) and the lines change their background to white. https://code.sololearn.com/WEgrG6Uno25N/?ref=app
2 Answers
+ 1
It seems that your js code is getting executed before the dom is ready.
also the method querySelector() returns the first element within the document that matches the specified selector, you should use querySelectorAll() to get all elements matching the specified selectors.
try by adding the code near closing end of body:
https://code.sololearn.com/WxFXZXak5k4k/#html
also you can use "load" or "DOMContentLoaded" events:
https://code.sololearn.com/Wa5jj7AyOki5/#js
+ 1
thanks Mohamed ELomari i got it !