jquery、选择器、样式
嗨 我如何通过jQuery将一些类测试添加到have style=display:none 输出:jquery、选择器、样式,jquery,find,Jquery,Find,嗨 我如何通过jQuery将一些类测试添加到have style=display:none 输出: <tr style="display:none" class="test"></td></td></tr> <tr></td></td></tr> <tr style="display:none" class="test"></td></td></tr>&
<tr style="display:none" class="test"></td></td></tr>
<tr></td></td></tr>
<tr style="display:none" class="test"></td></td></tr>>
<tr></td></td></tr>
谢谢那么:隐藏限定符就是您想要的:
$('div:hidden').addClass('test');
这有点古怪,因为:hidden不仅仅适用于具有显式display:none样式的元素。如果您真的希望它是健壮的,那么最好给隐藏的元素一些其他的类名,即使它没有任何CSS效果。然后你可以写:
$('div.testMe').addClass('test');
那么:隐藏限定符就是您想要的:
$('div:hidden').addClass('test');
这有点古怪,因为:hidden不仅仅适用于具有显式display:none样式的元素。如果您真的希望它是健壮的,那么最好给隐藏的元素一些其他的类名,即使它没有任何CSS效果。然后你可以写:
$('div.testMe').addClass('test');
或者如果你想改变它的风格。。使用
$(function() {
$('.test').css("display", "none");
});
或者如果你想改变它的风格。。使用
$(function() {
$('.test').css("display", "none");
});
你可以做:
$(".test[style*=none]")
或
或者最准确地回答你的问题
$(".test").filter(function() { return $(this).css('display') == 'none'; });
你可以做:
$(".test[style*=none]")
或
或者最准确地回答你的问题
$(".test").filter(function() { return $(this).css('display') == 'none'; });
$function{}相当于$document.loadfunction{}我实际上使用了$function{},但是很多jQuery noob不知道这种语法,所以我使用了更详细的语法。$function{}相当于$document.loadfunction{}我实际上使用了$function{},但是很多jQuery noob不知道这种语法,所以我使用了更详细的语法。我喜欢jquery如何让您更好地使用css:-$'tr:hidden'.addClass'test';我喜欢jquery如何让您在css方面做得更好:-$'tr:hidden'.addClass'test';问题是。。。如何将类测试添加到style=display:none的tr中?问题是。。。如何将类测试添加到style=display:none的tr中?唯一回答问题的人+1唯一回答问题的人+1