On my page, I have several divs which change their background image when the cursor hovers over them. The setup is akin to this:
#myDiv1 {
background-image: url("http://example.com/firstImage.png");
}
#myDiv1:hover {
background-image: url("http://example.com/secondImage.png");
}
#myDiv2 {
background-image: url("http://example.com/thirdImage.png");
}
#myDiv2:hover {
background-image: url("http://example.com/fourthImage.png");
}
<div id="myDiv1">Hello</div>
<div id="myDiv2">World</div>
I would like to read the URL of each div's :hover
background using JavaScript, without needing to invoke the :hover
state itself. Are there any selectors that can retrieve that data?