ok guyz, g开发者_如何学JAVAot one more question for you. i need to select only the first div ( where first child != 'you' ) how can i acheive that?
HTML
<div class="test">
<div id="me"><img src=""></div>
</div>
<div class="test">
<div id="you"></div>
</div>
what i mean is something like:
$('#test:first-child[id] != value');
well , that is what i need in theory, since i dont think the above line will work.
var yourElement = $(".test").not(":has(>#you:first-child)");
var allImages = yourElement.find("img");
translation: select an element which has class "test" and doesn't have a direct child (">") with the id of "you" which is the first element!
jsFiddle link: http://jsfiddle.net/y3RPD/3/
精彩评论