ie8で機能するため、jQueryを使用してテーブルをゼブラストライプします。
$('table.data tr:nth-child(odd)').css('background-color', '#ececec');
問題は、行を削除できるボタンがあることです。
$(this).parents('tr').remove();
これにより、ゼブラの縞模様が失われます。だから私は試しました:
$(this).parents('tr').remove();
$('table.data tr:nth-child(odd)').css('background-color', '#ececec');
$('table.data tr:nth-child(even)').css('background-color', '#ffffff');
と
$(this).parents('tr').remove();
$('table.data tr').css('background-color', '#ffffff');
$('table.data tr:nth-child(odd)').css('background-color', '#ececec');
どちらも機能しません。.remove()
コールバック関数がないか、ゼブラ ストライプを入れます。何か案は?
編集 - 上記のコードは機能しますが、css の競合がありました。(以下の回答を参照)。ただし、競合は背景色を設定しません。そのため、ルールが競合を引き起こす理由を知りたいと思います。