开发者

Why doesn't this jQuery selector work?

$('del, .set-ui-icon-15x41-new:has(:parent+div:has(ins))').toggle(500);

Basically I'm looking to toggle all del tags, and spans which have the class name of 'set-ui-icon-15x41-new' that have a parent which contains开发者_如何转开发 a child div that has an ins tag.

To simplify; this doesn't work either:

$('.set-ui-icon-15x41-new:parent')

But this does...

$('.set-ui-icon-15x41-new').parent()

So how can I get the :parent selector to work?


:parent will select elements that are parents, not the parent of the element.

Possible solution:

$(':has(ins) > .set-ui-icon-15x41-new')

Demo:

http://jsfiddle.net/bq4Au/

Updated demo after comments:

http://jsfiddle.net/bq4Au/5/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜