数据分析师2017-09-30 23:02:32
$( "html" ).parent() method returns a collection containing documents, while $( "html" ).parents() returns an empty collection. Can any expert explain it? -PHP Chinese website Q&A-The $( "html" ).parent() method returns a collection containing documents, while $( "html" ).parents() returns an empty collection. Can any expert explain it? -PHP Chinese website Q&A
Please watch and learn.
迷茫2016-12-20 09:17:19
parents()是取得一个包含着所有匹配元素的祖先元素的元素集合(不包含根元素),而parent()是取得一个包含着所有匹配元素的唯一父元素的元素集合。当$的对象是根元素html时,parents()就是空集合,parent()就是文档集合