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?

2
  • Just curious on why you would want to do that Commented Feb 6, 2012 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. Commented Feb 6, 2012 at 17:08

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I have looked at that, but it doesn't help with my problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.