gaurav gaurav - 1 year ago 86
jQuery Question

Get access to all css style properties?

I want to get access to all CSS properties (not only for a specific selector or element but all) through JavaScript.

I want to iterate through all properties of the


How can i do this?

Answer Source

you can use CSSStyleDeclaration object. A CSSStyleDeclaration object makes CSS style attributes available through JavaScript properties. The names of these JavaScript properties correspond closely to the CSS attribute names.

this object has two additional properties:

The textual representation of a set of style attributes and their values. The text is formatted as in a CSS stylesheet, minus the element selector and the curly braces that surround the attributes and values.

The number of attribute/value pairs contained in this CSSStyleDeclaration. A CSSStyleDeclaration object is also an array-like object whose elements are the names of the CSS style attributes that are declared.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download