0

I have a situation where a div has two CSS display properties. One is set to none and the other is set to block. However, display: none overrides display: block because of CSS specificity.

I can use JavaScript/jQuery to find out the display value of this element. In this given scenario, the result would be none because it is the overriding style. However, I would like to be able to retrieve all of the display values on this element. I want my JavaScript to return none as well as block.

Is this even possible?

  • Just curious on why you would want to do that – Ninja Feb 06 '12 at 17:06
  • I'm working on a jQuery plugin that needs to use the `display` value on an element, ignoring all values of `none`. So in this example the plugin would use `block` as its value. –  Feb 06 '12 at 17:08

1 Answers1

0

You need to look at the class names for the element and look them up in the stylesheet.

See: Read CSS property of an element using JavaScript

Community
  • 1
  • 1
Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176