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 span
s 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/
精彩评论