不明白find与​child的区别。什么情况下find与children等价?
小白
小白 2016-12-20 09:10:19
0
2
946
小白
小白

好好学习,天天向上!!!

reply all(2)
数据分析师

I don’t understand the difference between find and child. Under what circumstances is find equivalent to children? -PHP Chinese website Q&A-I don’t understand the difference between find and child. Under what circumstances is find equivalent to children? -PHP Chinese website Q&A

Please watch and learn.

迷茫

这种情况下

<div class="div">
    <p>pXXXXXp</p>
    <p>pXXXXXp</p>
    <p>pXXXXXp</p>
    <p>pXXXXXp</p>
<div>
 
$(".div").find("p") == $(".div").children()

find()用于查找后代元素,children()用于查找子代元素,显然,后代元素就包含了子代元素,因此find的查找范围比children大,你只需在find()括号里面加入适当的选择器就可以实现children()的功能了。

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!