我正在尝试使用jquery切换一些表行。初始状态处于隐藏状态
这是有效的
$('.table tr.items.' + name).each(function() {
$(this).show();
});
并且此代码也有效
$('.table tr.items.' + name).each(function() {
$(this).show();
});
但是有了这个代码
$('.table tr.items.' + name).each(function() {
$(this).toggle();
});
在第一次调用中,将显示行,但在第二次调用中,它们不会隐藏。我可以看到样式设置为style="display: table-row;" 在第二次调用中。你对如何解决这个问题有想法吗?
js:
$('.table tr.items.' + name).toggleClass("notShow");
.css:
.notShow{
display: none;
}