Home > Web Front-end > JS Tutorial > jQuery visibility filter:hidden and :visibility usage example_jquery

jQuery visibility filter:hidden and :visibility usage example_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 15:52:55
Original
1855 people have browsed it

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"的元素

Copy after login

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.

Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template