Here's a code snippet I have:
const myDiv = document.querySelector("#myDiv");
myDiv.addEventListener("click", fct_Div);
function fct_Div(ev) {
console.log(ev);
if (ev.altKey === true) {
myDiv.style["background-color"] = "blue";
}
}
And the corresponding CSS:
#myDiv {
width: 400px;
height: 400px;
border: 1px solid black;
}
#myDiv:hover {
background-color: lightblue;
}
I'm interested in changing the background color of #myDiv:hover
.
Is there a way to achieve this?
Your assistance is appreciated.
Andreï