How do I gather a class' css attributes given nothing but the className?
- by user1128571
For example I might have some css stuff that looks like this:
.divType1 {
position: absolute;
width: 60px; height: 60px;
left: 400px; top: 100px;
border: 1px solid #89B;
z-index: 0;
}
Now within Javascript I want to gather div class divType1' css attributes, but am provided only with the div class, so I can't do something of form ( pseudo-code ):
selectDivWithClass( divType1 ).getCss(left).
I could hack something by instantiating a div with class divType1 and grab its css attributes, and then destroy it, but is there a better way?