Why is this button not hiding on clicking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why is this button not hiding on clicking

Button not hiding https://code.sololearn.com/WeC5wER8RH2X/?ref=app

1st Dec 2021, 11:17 PM
D Doyen
D Doyen - avatar
2 Answers
+ 1
querySelector is similar to CSS selector If you target an element by id you need to use a '#' in front of the id.
1st Dec 2021, 11:45 PM
ODLNT
ODLNT - avatar
+ 1
ODLNT you are right. But it will still have problems with querySelector on the mobile version of SoloLearn, or with func() on the Desktop version. As you noted here: https://www.sololearn.com/Discuss/2783211/why-the-code-is-not-working He would need to write window.func = function(){} instead of function func(){}. And something to do with querySelector for the mobile version - right now it outputs null even if it's "#e" or just "button". If you put it directly in window.func , it works fine.
2nd Dec 2021, 1:13 AM
Alexey Kopyshev
Alexey Kopyshev - avatar