Why won’t the “div”s disappear?

I am new and making a project, but I have hit a roadblock. I made this demonstration to show my problem. I have already tried: -Turning the opacity to 0.0 -Adding “.style” -Moving the “div”s off of the page -Rearranging the order of the code How do I make the red rectangle disappear when it is clicked? https://code.sololearn.com/WjRXII7LxJVO/?ref=app

2/14/2020 11:37:00 PM


1 Answer

New Answer


document.getElementsByTagName returns an array, so it considered ".display" as an array attribute, which is not the case. You should select only the first element, using document.getElementsByTagName[0], here is the code: https://code.sololearn.com/Wo8Oy3wcUiZF/?ref=app