0

I try to get color property for the :hover pseudo-element, but result is no good (I get the color of the element without :hover).

console.log(window.getComputedStyle(document.getElementById('ok'), ':hover').getPropertyValue("color"));
#ok {
  color: black;
}
#ok:hover {
  color: white;
}
<p id=ok>Hello</p>

How to do ?

0 Answers0