Hi I have an element (dom node) and it has a pseudo CSS hover CSS style. I want to use Javascript to get this CSS style, am in the Chrome web browser.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can get the computed styles (currently applied styles) of an element using
window.getComputedStyle(element)For your case, you can call the above when the element is hovered and use the saved style object later on for your purpose.
Ref: https://developer.mozilla.org/en-US/docs/DOM/window.getComputedStyle
Demo: http://jsfiddle.net/ur297/
Code: