How to retrieve CSS style object by CSS class name?
Posted
by
Chir
on Stack Overflow
See other posts from Stack Overflow
or by Chir
Published on 2011-02-27T05:25:45Z
Indexed on
2011/02/27
7:25 UTC
Read the original article
Hit count: 82
JavaScript
Hi,
Is it possible to get all properties of a css class associated with an element?
e.g.
.hightligh {
font-weight: bold;
border: 1px solid red;
padding-top:10px;
}
Lets say the css class "hightlight" is assigned to div element
<div class='highlight'></div>
Now using JavaScript, I need to iterate through all style properties of css class "highlight" associated with the div element. Basically, I want to treat it as a JavaScript object whose properties can be accessed using iterator or for loop.
Thanks in advance
© Stack Overflow or respective owner