In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article focuses on "jquery how to check whether elements are hidden", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "jquery how to check whether elements are hidden"!
Jquery check whether the element is hidden methods: 1, the use of is () method and ": hidden" selector, syntax "element object. Is (": hidden ")"; 2, the use of is () method and ": visible" selector, syntax "element object .is (": visible ")".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery checks whether the element is hidden
1. Using is () method and ": hidden" selector
$(document) .ready (function () {$("button") .click (function () {if ($("# hide"). Is (": hidden")) {console.log ("# hide element is hidden") } else {console.log ("# hide element is not hidden, it is visible") } if ($("# show") .is (": hidden") {console.log ("# show element is hidden") } else {console.log ("# show element is not hidden, it is visible");});}) # hide element-I am hidden content, you can't see me. # show element-I am the content displayed, you can see me.
Check whether the element is hidden
2. Using is () method and ": visible" selector
$(document) .ready (function () {$("button") .click (function () {if ($("# hide") .is (": visible")) {console.log ("# hide element is not hidden, is visible") } else {console.log ("# show element is hidden");});})
The running result is the same as the figure above.
Description:
Visibility filter selector:
$("div:hidden") selects all invisible elements
$("div:visible") selects all visible elements
The is () method is used to see if the selected element matches the selector.
At this point, I believe you have a deeper understanding of "jquery how to check whether the element is hidden". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.