In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "what is children in jQuery". 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 "what is children in jQuery".
In jQuery, children means "children" and is a filter used to filter the children of the current jQ object to get eligible children, that is, to find all child elements; the syntax is "object .children (filter)", and the parameter "filter" is used to set conditions to narrow the search for child elements.
The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.
In jQuery, children means "children".
Children is a filter, as the name implies, to filter children, to filter the children of the current jQ object, to get eligible children, that is, to find child elements.
The children () method returns all direct child elements of the selected element. This method only traverses a single level down the DOM tree.
Syntax:
$(selector) .children (filter)
Parameter "filter": used to set conditions that specify selector expressions that narrow the scope of the search child elements.
Example 1: all direct child elements returned
Display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px } $(document) .ready (function () {$("ul"). Children (). Css ({"color": "red") "border": "2px solid red"}) }) Body (great ancestor node) div (ancestor node) ul (direct parent node) li (child node) span (grandnode) Li (child node) span (grandnode)
Example 2: narrow the search
All elements with the class name "1" in the immediate child elements returned using the filter parameter
Display: block; border: 2px solid lightgrey; color: lightgrey; padding: 5px; margin: 15px } $(document) .ready (function () {$("ul"). Children ("li.1"). Css ({"color": "red") "border": "2px solid red"}) }) Body (great ancestor node) div (ancestor node) ul (direct parent node) li (child node) span (grandnode) Li (child node) span (grandnode)
Thank you for your reading, the above is the content of "what is children in jQuery". After the study of this article, I believe you have a deeper understanding of what the children in jQuery is, and the specific use needs to be verified in practice. 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.
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.