lundi 22 mars 2021

Create highlight effect on hover an element

I tried to make highlight effect on each <a> element while I hover on each div element but it doesn't work and console shows this error

"Uncaught TypeError: Cannot set property 'background' of undefined at highlight_function"

enter image description here

function highlight_function () {document.getElementsByTagName("a").style.background="#80ff00"};

             document.getElementsByTagName("div").addEventListener("mouseover",highlight_function())



Aucun commentaire:

Enregistrer un commentaire