テーブルストライピングからネストしたテーブルを除外しようとしています。ここでは、テーブルをストライプに私のコードは次のとおりです。jQueryでテーブルストライピングからネストしたテーブルを除外します
$(".stripeTable tbody tr:odd").addClass("stripe");
私の質問は、私はクラスの「ストライプ」を受信すると、ネストした表の奇数行を防ぐ方法、ありますか?
ブラウザから生成されたコードは次のとおりです。ネストした表からclass = "stripe"を削除します。ネストされたテーブルは、同様stripeTable
クラスを持っている場合は、あなたが.stripeTable
を固定する必要があるかもしれません
$(".stripeTable > tbody > tr:odd").addClass("stripe");
:のみ、トップレベルのテーブルがstripeTable
クラスを持っている場合は、単にいくつかの子セレクタ>
追加
<table>
<tr>
<td>My Table Cell </td>
</tr>
<tr class="stripe">
<td>
<table>
<tr>
<td>My nested table cell</td>
</tr>
<tr class="stripe">
<td>my nested table cell (remove the stripe!)</td>
</tr>
</table>
</td>
</tr>
</table>
「stripeTable」クラスはどこですか? – BoltClock