开发者

jQuery to hide all row classes except 'row2' only when the parent class is viewContainerTop

开发者 https://www.devze.com 2022-12-11 08:26 出处:网络
I\'ve been to jquery select class inside parent div and Testing objects for ancestor/descendent relationship in JavaScript or Jquery and jQuery wild card character but can\'t seem to fit the pieces to

I've been to jquery select class inside parent div and Testing objects for ancestor/descendent relationship in JavaScript or Jquery and jQuery wild card character but can't seem to fit the pieces together. Thanks.

<div id="viewContainerTop" class="top">
    <div class="row1"></div>
    <div class="row2"></div>
    <div class="row2"></div>
    开发者_如何学C<div class="row2"></div>
    <div class="row3 first"></div>
    <div class="row3"></div>
    <div class="row3"></div>
</div>


Machting the code you posted (parent has id viewContainerTop)

$("#viewContainerTop > div:not(.row2)").hide();

Matching what you wrote (parent has class not id viewContainerTop)

$(".viewContainerTop > div:not(.row2)").hide();


$("#viewContainerTop > div:not(.row2)").hide();
0

精彩评论

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