How to use jquery children and find jquery child

$(document).ready(function()$("ul").children().css("color": "red", "border": "2px solid red"););

Definition & Usage

The children() method returns all direct children of the selected element.

Bạn đang xem: How to use jquery children and find jquery child

The DOM tree: This method only traverse a single màn chơi down the DOM tree. To traverse down multiple levels (to lớn return grandchildren or other descendants), use the find() method.

Tip: To traverse a single màn chơi up the DOM tree, or all the way up khổng lồ the document"s root element (khổng lồ return parents or other ancestors), use theparent() or parents() method.

Note: This method does not return text nodes. To return all children including text nodes, use the contents() method.

Xem thêm: Ví Dụ Về Vòng Lặp Trong Php, Bài 5: Các Lệnh Điều Khiển Trong Php


Parameter Description
filter Optional. Specifies a selector expression khổng lồ narrow down the tìm kiếm for children

Return all direct children of How to return all direct children of an element.

Narrow down the searchHow to use the filter parameter to lớn return all elements with the class name "first", that are direct children of .

Return all elements that are direct children of

Show the descendants of an element by tag namesA demonstration which shows who the descendants of a


Play Game


Report Error

If you want to lớn report an error, or if you want khổng lồ make a suggestion, bởi vì not hesitate to send us an e-mail:

Top TutorialsHTML TutorialCSS TutorialJavaScript TutorialHow To TutorialSquốc lộ TutorialPydong dỏng TutorialW3.CSS TutorialBootstrap TutorialPHPhường. TutorialJava TutorialC++ TutorialjQuery Tutorial
Top ReferencesHTML ReferenceCSS ReferenceJavaScript ReferenceSQL ReferencePyhạn hẹp ReferenceW3.CSS ReferenceBootstrap ReferencePHPhường ReferenceHTML ColorsJava ReferenceAngular ReferencejQuery Reference
Top ExamplesHTML ExamplesCSS ExamplesJavaScript ExamplesHow To ExamplesSQL ExamplesPydong dỏng ExamplesW3.CSS ExamplesBootstrap ExamplesPHP. ExamplesJava ExamplesXML ExamplesjQuery Examples
Web CoursesHTML CourseCSS CourseJavaScript CourseFront End CourseSQL CoursePyhạn hẹp CoursePHP CoursejQuery CourseJava CourseC++ CourseC# CourseXML CourseGet Certified »