Confusions with CSS and JavaScript relations ?

Posted by Anil Namde on Stack Overflow See other posts from Stack Overflow or by Anil Namde
Published on 2010-05-31T12:51:23Z Indexed on 2010/05/31 13:03 UTC
Read the original article Hit count: 209

Filed under:
|

I have table cell which has class "cellActive". Which has following defination

.cellActive{background:"#DDDDDD"}

Now i am trying to read the background color property for the cell and it comes null/"".

var bgColor = cell.style.backgroundColor; // returning ""

Is that something mistake on my part of its by behavior. If CSS class is assigning CSS to element can't we read its value in JS ? Does this mean that if we are not assigning property directly to the element we cant get it if in case its inheriting it ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about css