Can't get item style

<div id="sam"> <div class="cat"></div> <div class="cat"></div> <div class="cat"></div> <div class="cat"></div> </div> var strChild = sam.childNodes[0] if(strChild.style.color == '') // True 

color: black;

  • The style is what is directly indicated in the style attribute - timka_s
  • why then alert (strChild.style) == [object CSSStyleDeclaration], CSS keyword And how then to get access to CSS And if you do it through jQuery, does it find it? - Zow
  • one
    Scrap jQuery and see how it's done there. Then it will not seem nonsense. - ling

1 answer 1

You must access the currentStyle (IE) property or call the getComputedStyle method.