How to make that Green box to appear on clicking that Red box | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to make that Green box to appear on clicking that Red box

I want to get it by Id assign it to a variable then use to make the third green appear https://code.sololearn.com/W6LGd6lSvZmu/?ref=app

20th Nov 2021, 11:47 PM
D Doyen
D Doyen - avatar
1 Answer
+ 2
When you select button, you use "document.getElementsByTagName" so you choose all elements with tag button, and you got array. (when your selector have elementS, it will always return array) So you need to access your button with index https://code.sololearn.com/WRxEZhjcKue7/?ref=app
20th Nov 2021, 11:56 PM
PanicS
PanicS - avatar