我正在努力实现我们在 gmail 中看到的东西。当我将鼠标悬停在它上面时,它会更改文本颜色,单击时会将文本的颜色更改为红色。当我单击另一行时,会发生同样的事情。但是,就我而言,由于我的新手知识,我错过了一些东西。我需要取消绑定上一次单击,因为上一次单击使文本保持红色。
$("#index td").hover(
function() {
$(this).css( {'background': '#e9e7e7',
'cursor': 'pointer'});
},
function () {
$(this).css({'background': '#ffffff',
'cursor': 'pointer'});
}
).click(function(){
$(this).css({ 'color': 'red'});
});
编辑
<tr style="background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(255, 255, 255); cursor: pointer; background-position: initial initial; background-repeat: initial initial; " class="selected"><td style="padding:2.5px 0px 2.5px 2px;">XYZZZZ</td></tr>