我想选择'这个'和其他东西。例如:
$(this + ', ' + this + ' > div')
我该怎么做才能做到这一点?这可能在一个选择器中吗?
答案 0 :(得分:6)
您可以使用.andSelf()
跳回链中并包含该元素,如下所示:
$(this).children("div").andSelf()
所以我们从this
转到它的孩子,然后.andSelf()
向该集合添加之前链中的内容this
。
答案 1 :(得分:0)
您可以将结果添加到另一个:
$(this).add('div', this)