Question: Write and register an event handler that changes the color of the h 1 element to gold on mousemove. let h 1 Element = document.getElementsByTagName

Write and register an event handler that changes the color of the h1 element to gold on mousemove.
let h1Element = document.getElementsByTagName("h1")[0];
function changeColorToGold(){
h1Element.style.color = "gold";
}
document.addEventListener("mousemove", changeColorToGold);

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!