Home >Web Front-end >JS Tutorial >jQuery :Introduction to how to use the visible selector
Overview
Match all visible elements
Example
Description:
Find all visible tr elements
HTML code :
<table> <tr style="display:none"> <td>Value 1</td> </tr> <tr> <td>Value 2</td> </tr> </table>
jQuery Code:
$("tr:visible")
Result:
[ <tr><td>Value 2</td></tr> ]
This selector matches all currently visible elements.
Grammar structure:
$(":visible")
This selector is generally used in conjunction with other selectors, such as Class selector and Element selector, etc. wait. For example:
$("div:visible").css({color:"blue"})
The above code can set the font color in the visible div element to blue.
If not used with other selectors, the default state is used with the * selector, for example, $(":visible") is equivalent to $("*:visible").
Example code:
Example 1:
我是不可见的我是可见的
##The above code can set the text color in the visible div is blue. Example 2:
脚本之家 我是不可见的我是可见的
The above is the detailed content of jQuery :Introduction to how to use the visible selector. For more information, please follow other related articles on the PHP Chinese website!