I'm trying to find all the parent elements that have the CSS style display:none
. I can't seem to get it to work though. Here's what I've got:
var $parents = $(...).parents("[css=display:none]");
If you want the ones that are actually display: none;
(not just possibly contained in another display: none;
), you can use .filter()
and .css()
to get those parents, like this:
var $parents = $(...).parents().filter(function() {
return $(this).css('display') == 'none';
});
This gets the parents, then filters them to get only the ones that are display: none;
on that specific parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With