One way is to use the pseudo-selector :visible jQuery mentioned in Adil.
A common mistake is that if an element with the .highlight class .highlight nested in a container that is hidden, you cannot get it, although this element has display: block
Instead, you can use css regex as follows: $('.highlight[style*="display: block"]')
A common mistake is that you need to know exactly how the rule is written. If there is no space before block : display:block instead of display: block , you also cannot get the element.
To overcome this, you need only look for the block expression in the following styles: $('.highlight[style*="block"]')
dimitrisk
source share