Home > Article > Web Front-end > jQuery visibility filter:hidden and :visibility usage example_jquery
The examples in this article describe the usage of jQuery visibility filters: hidden and: visibility. Share it with everyone for your reference. The specific analysis is as follows:
:hidden
Matches all invisible elements. If you use the visibility attribute of CSS to make the element not display but take up space, it is not hidden
Find the tr element of display:none, $("tr:hidden")
:visible
Match all visible elements
Find all elements whose display is not none, $("tr:visible")
Example:
<tr id="one"style="display:none;"><td>1</td><td>2</td></tr> <tr id="two"style="visibility:hidden;"><td>3</td><td>4</td></tr> <tr id="three"><td>5</td><td>6</td></tr> $("tr:hidden");//选中id为one的元素 $("tr:visible");//选中id为"two"和"three"的元素
Actually, the two filters here do not care whether the element is hidden or not. I think as long as it is display:none, you can use: hidden to get it. If there is no display:none, you can get it no matter what it is.
I hope this article will be helpful to everyone’s jQuery programming.