单击下一个表格行后,突出显示行不会消失

我需要在表格行中选择菜单选项的齿轮图标时创建黄色背景,我已尝试使用以下代码突出显示表格行,

var view = Core.view.Menu.create({ model: model, menuContext: { ibmm: ibmm }, anchor: this.$(), highlight: this.$().parents('tr:first').css('background-color','yellow') }); view.show(); 

在使用齿轮图标从表格行(隐藏)中选择菜单时,背景颜色很好。

在此处输入图像描述

相应的html文件如下

  

但是当我移动到下一个表格行(非隐藏)时,过去的表格行颜色仍然是黄色,不会消失。

在此处输入图像描述

当我点击该行时,我正在使用以下css代码创建突出显示

 table.content-table.highlighted tr.content-row:focus { background: #FFFF99 none 0 0 repeat; } 

任何人都可以建议我这个代码。 我正在使用Ember 1.4.0。

您可以在jquery下方尝试重置焦点输出事件的背景颜色。

 $(function(){ $("table.content-table.highlighted tr.content-row").on("focusout", function(){ $(this).css('background','#FFFF00 none 0 0 repeat'); // change color code as per your need }); }); 

检查:first:first-child之间的区别

 var view = Core.view.Menu.create({ model: model, menuContext: { ibmm: ibmm }, anchor: this.$(), highlight: this.$().parents('tr:first-child').css('background-color','yellow') }); view.show();