jQuery visibility filters: hidden and: visibility usage instances
- 2020-06-19 09:43:40
- OfStack
This article illustrates the use of jQuery visibility filters: hidden and: visibility. Share to everybody for everybody reference. The specific analysis is as follows:
:hidden
Matches all invisible elements. If you use the visibility attribute of css to make the element unvisible but placeholder, it is not hidden
Find the tr element for display:none, $("tr:hidden")
:visible
Matches all visible elements
Find all display elements that are 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");// The selected id for one The elements of the
$("tr:visible");// The selected id for "two" and "three" The elements of the
In fact, the two filters don't care whether the element is hidden or not, I think display:none will fetch it as long as it is display:none, if not display:none, whatever it is.
Hopefully, this article has helped you with your jQuery programming.