数据分析师2017-09-30 23:02:51
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.
迷茫2016-12-20 09:12:00
这种情况下
<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()的功能了。