How to read from CSS files with jQuery

Posted by Neurofluxation on Stack Overflow See other posts from Stack Overflow or by Neurofluxation
Published on 2010-06-03T08:51:44Z Indexed on 2010/06/03 8:54 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

Ok, I have a HTML page with jQuery included.

I have a CSS file with a good load of lines in, I would like to read all styles for a given element from the external CSS file... Not the inline styles...

I have the following code (which looks like it should work...):

var styleProperties= {};
var getCssProperties = ['width', 'margin', 'height']; 

for (c=0;i<=returnStyleProps.length;c++) {
    styleProperties[returnStyleProps[c]] = $('div#container').css(returnStyleProps[c]);
    alert(styleProperties);
}
alert(styleProperties);

But this only seems to alert:

"[Object Object]"

Any ideas you clever people?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery