In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces jquery how to judge the existence of dom element, the article is very detailed, has a certain reference value, interested friends must read it!
Jquery to determine the existence of dom element method: 1, use the "$(" # id ")" statement to get the dom element object through the id attribute; 2, use the "element object .length" statement to obtain the length value; 3, determine whether the obtained length value is greater than 0, if it is greater than it exists, otherwise it does not exist.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
Jquery determines whether the dom element exists.
Realize the idea:
Get the dom element object through the id attribute in the js file
Use the length attribute to get the length of the dom element object, or length=1 if the element exists
Determine whether the duration value is greater than 0
Implementation code:
If ($("# id"). Length > 0) {/ / element exists, then length=1 alert ("element exists");} else {/ / element does not exist, then length=0 alert ("element does not exist");} above is all the content of the article "how jquery determines whether the dom element exists". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.