children() is an inbuilt method in jQuery which is used lớn find all the children element related lớn that selected element. This children() method in jQuery traverse down to a single level of the selected element và return all elements.
Bạn đang xem: Jquery Parent > Child SelectorSyntax:$(selector).children()Here selector is the selected element whose children are going lớn be found.Parameter: It does not accept any parameters.Return values: It returns all the children of the selected element.jQuery code to show the working of this function:Code #1: In the below code, all the elements directly connected to the “div” element get highlighted with the green color.
Xem thêm: download game us conflict
An optional parameter can also be used khổng lồ the children() method to filter the tìm kiếm for children elements.Syntax:$(selector1).children("selector2")Here selector1 is the selected element whose children are going lớn be found.Parameters: It accepts a parameter which is specified below-selector2: This is the prior children among mỏi all the children of the selected element.
Return value: It returns the prior children of the selected element.Code #2: In the below code, among muốn all the paragraph element, elements of first paragraph gets selected & highlighted with thegreen color.
How khổng lồ make border around all unordered các mục items that are children of a specified class using jQuery ?