jQuery/CSS - How do I select all the <li style="display: none;">
in the document?
While the chosen answer works in your case, it's still doesn't answer the question. Same for the answers posted by other people, so I decided to write this anyway.
$('li[style*="display: none"]')
This will return a jQuery object representing a list of all the <li>
elements in your document with a style property containing "display: none".
This is a different thing that finding all the hidden elements in the document.
There is a selector to find hidden elements:
$('li:hidden')
Note that this finds all li
elements that are not visible, not only because they have the style display:none
applied to them. The element could be hidden for example by setting their height to zero, or hiding the parent element.
Try this
$("li").filter(function() { return $(this).css("display") == "none" })
$('li:hidden')
- Try as per jquery document it will work
Fore more dtail - :hidden Selector
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