Seven circles but only one is changing colour, why?

前端 未结 8 1363
梦谈多话
梦谈多话 2021-01-26 09:29

I am new to javascript and I have an assignment to create seven circles which should change colour on a mouse click. The first circle is changing colour but the other six just r

8条回答
  •  感情败类
    2021-01-26 09:39

    An id (identifier) needs to be unique, document.getElementById() always catches the first one only.

    Use a class and loop

提交回复
热议问题