2

I'm looking for a way to get all css styles of an element that are defined in external stylesheet ( style.css ? ) or in HTML ( inline css ).

All solutions i found tend to return [object] so user can apply to another Element.

The following code prints all elements not just those that are defined.

$(this).css("cssText");

Any idea ?

owoulles
  • 21
  • 1

1 Answers1

0
<script>    
    $("div").each(function(){       
        /* FROM EXTERNAL CSS STYLESHEET */    
        var currentStyle = this.currentStyle
        var opacityStyle = currentStyle.opacity /* get opacity for example */
    })
</script>
Luis
  • 5,786
  • 8
  • 43
  • 62
Bny
  • 41
  • 5
  • The problem is that styles vary from element to element. I dont know what elements are defined in external stylesheet for element, say, X. – owoulles Dec 27 '13 at 22:04