i want to sel开发者_运维百科ect ´this´ and something else. for example:
$(this + ', ' + this + ' > div')
how can i make this work? Is this possible in a single selector?
You can use .andSelf()
to hop back in the chain and include the element before as well, like this:
$(this).children("div").andSelf()
So we go from this
to it's children, then .andSelf()
adds to that collection what was in the chain before, which was this
.
You can add a result to another:
$(this).add('div', this)
精彩评论