How do I find all the css properties set explicitly via the style attribute?
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.
Let’s say you wanted to get the styles of an element named “myp”:
Working JSFiddle here produces output:
Only the info in style is output, even though a class sets a font size and a CSS directly applies a background color.
You could also read the style attribute text and parse it yourself, which is less accurate but if you wanted to include invalid statements you’d need this.