扩展jquery$(此)
如何将选择器从$(this)扩展到,比方说,它的子项?或者其他任何事情。我的意思是,如何正确地将他们与$(这个)联系起来 比如: 很抱歉,如果已回答此问题,则找不到它。您可以使用来完成此操作:扩展jquery$(此),jquery,jquery-selectors,this,Jquery,Jquery Selectors,This,如何将选择器从$(this)扩展到,比方说,它的子项?或者其他任何事情。我的意思是,如何正确地将他们与$(这个)联系起来 比如: 很抱歉,如果已回答此问题,则找不到它。您可以使用来完成此操作: $(this).children().andSelf().something(); 您还可以使用弹出当前链的最后一个筛选操作。因此,如果你想要孩子和兄弟姐妹,你也可以做到: $(this) .children() // children of "this" .end()
$(this).children().andSelf().something();
您还可以使用弹出当前链的最后一个筛选操作。因此,如果你想要孩子和兄弟姐妹,你也可以做到:
$(this)
.children() // children of "this"
.end() // now we're back to "this"
.siblings() // siblings of "this"
.andSelf() // and "this" itself
.something();
哈哈,这是目前为止最快的。谢谢@辛克鲁格:没问题!很乐意帮忙。
$(this)
.children() // children of "this"
.end() // now we're back to "this"
.siblings() // siblings of "this"
.andSelf() // and "this" itself
.something();