+ 2

why onmouseover method of javascript does not work with classnames?

I am using "getElmentbyClassName" to style group of html links but it does not work help me https://code.sololearn.com/WGqi77Nc4CeJ/?ref=app

5th Oct 2021, 7:36 PM
AmirhosseinYazdani
AmirhosseinYazdani - avatar
2 Antworten
+ 1
When you use className you got array of every element with this class name, even if this is only one element, thats why you need index, also it is elementById not elementsById, you can only have 1 id. And there is no onclick inside js, we need to use addEventListener https://code.sololearn.com/WM5AyRGMf3Uk/?ref=app
5th Oct 2021, 9:06 PM
PanicS
PanicS - avatar
+ 3
thank you bro you rock .🙌
5th Oct 2021, 11:02 PM
AmirhosseinYazdani
AmirhosseinYazdani - avatar