In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how jquery deletes all the elements under the node". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "jquery how to delete all the elements under the node".
Jq delete all elements under the node method: 1, use find () to get all under the node (including a subset of the subset) subset elements, syntax "specify node object .find (" * ")", will return a collection of elements; 2, use remove () to delete all elements in the set of elements, syntax "element collection .remove ()".
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
The method of deleting all elements under a node by jquery
Realize the idea:
Use the find () method to get all subset elements (including subsets of subsets) under this node
Use the remove () method to delete all acquired subset elements
Implementation code:
.div, div * {display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px } ul * {color:red; border:2px solid red } $(document) .ready (function () {$("button") .on ("click", function () {$("ul") .find ("*") .remove () );}) Div (parent node) ul (specified element) li (child node 1) span (grandnode 1) Li (Child Node 2) span (grandNode 2) li (Child Node 3) span (grandNode 3) Delete all elements under the ul node
Thank you for reading, the above is the content of "how jquery deletes all elements under the node". After the study of this article, I believe you have a deeper understanding of how jquery deletes all elements under the node. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.