我有一个 div 填充了一个列表/行的 div 现在我需要为行提供替代颜色。为此,我正在做以下事情
$('#PlatformErrorsTableData').html(table1Html);
$('#PlatformErrorsTableData div:nth-child(even)').css("background-color", "aqua");
table1Html 如下所示:
<div>
<span class="platformTable columnWidth10">Originator1</span>
<span class="platformTable truncate">Message for Originator# 1</span>
<span class="platformTable columnWidth15">Server1</span>
<span class="platformTable columnWidth20">5:50 PM</span>
</div>
<div>
<span class="platformTable columnWidth10">Originator2</span>
<span class="platformTable truncate">Message for Originator# 2</span>
<span class="platformTable columnWidth15">Server2</span>
<span class="platformTable columnWidth20">5:50 PM</span>
</div>
<div>
<span class="platformTable columnWidth10">Originator3</span>
<span class="platformTable truncate">Message for Originator# 3</span>
<span class="platformTable columnWidth15">Server3</span>
<span class="platformTable columnWidth20">5:50 PM</span>
</div>
<div>
<span class="platformTable columnWidth10">Originator4</span>
<span class="platformTable truncate">Message for Originator# 4</span>
<span class="platformTable columnWidth15">Server4</span>
<span class="platformTable columnWidth20">5:50 PM</span>
</div>
现在的问题是颜色 aqua 没有显示在屏幕上,但是如果我在 firebug 中检查 div,它的背景颜色设置为 aqua。
任何帮助深表感谢。