In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-26 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.