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

13th Jul 2019, 9:02 PM
Matheus Rodrigues
Matheus Rodrigues - avatar
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
13th Jul 2019, 11:50 PM
MO ELomari
MO ELomari - avatar
+ 1
thanks Mohamed ELomari i got it !
14th Jul 2019, 1:26 AM
Matheus Rodrigues
Matheus Rodrigues - avatar