0

I have a certain jQuery selection and I am looking to find the closest element (so self or parent) that is a block element (display: block).
The style is not necessarily inline, so the selector [style*=display:block] does not work in every case for me. I think I would need to use the computed style rather but need an efficient way to do that (if possible without a $(this).parents().andSelf().each loop)

Horen
  • 11,184
  • 11
  • 71
  • 113

1 Answers1

0

As @EricG has posted in the comments Detect inline/block type of a DOM element was the answer to the question:

var elementStyle  =  element.currentStyle || window.getComputedStyle(element, ""); 
var displayType   =  elementStyle .display;
Community
  • 1
  • 1
Horen
  • 11,184
  • 11
  • 71
  • 113