在下面的代码中,我希望看到显示的 Red、Blue、Green 和 Brown 行,但是除了 Red 之外的所有行似乎都被隐藏了,就好像 nextUntil 参数被忽略了一样。有什么线索吗?谢谢。
经过一番研究,我都尝试了
$("#firstrow").nextUntil('span[class="hues"]').hide();
和
$("#firstrow").nextUntil('span:not(.colors)').hide();
的HTML:
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"/>
<script>
$(document).ready(function() {
$("#firstrow").nextUntil('span[class="hues"]').hide();
//$("#firstrow").nextUntil('span:not(.colors)').hide();
});
</script>
</head>
<body>
<table id="colortable">
<tr id="firstrow">
<span class="colors">Red</span>
</tr>
<tr>
<span class="colors">Orange</span>
</tr>
<tr>
<span class="hues">Blue</span>
</tr>
<tr>
<span class="shades">Green</span>
</tr>
<tr>
<span class="colors">Brown</span>
</tr>
</table>
</body>
</html>