Home > Web Front-end > JS Tutorial > body text

jQuery help filtering and finding children([expr])_jquery

WBOY
Release: 2016-05-16 18:11:16
Original
891 people have browsed it

children([expr])
Gets an element set containing all child elements of each element in the matched element set.
You can filter matching child elements through optional expressions. Note: parents() will find all ancestor elements, while children() will consider child elements but not all descendant elements.
Return value: jQuery
Parameters:
expr (String): (optional) Expression used to filter child elements.
Example:
Find every child element in a DIV.
HTML code:

Copy code The code is as follows:

Hello< /p>

Hello Again

And Again



jQuery code:
Copy code The code is as follows:

$("div").children()

Result:
Copy code The code is as follows:

Hello Again

Find the class .selected in each div.
HTML code:
Copy code The code is as follows:
Hello< ;/span>

Hello Again

And Again



jQuery code:
Copy code The code is as follows:
$("div").children(".selected")


Result:
Copy code The code is as follows:

Hello Again

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!