Javascript 从值设置背景 aaaaaaaaaaaa

Javascript 从值设置背景 aaaaaaaaaaaa,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我希望收到: $('a[title=“t”]')。每个(function(){//the$('a[title=“t”])。每个(function(){//the尝试一下,我认为它应该可以工作: $('a[title="t"]').each(function() { // the <a> you want to look at var tr = $(this).parents('tr'); // the tr of this <a> tr.css({

我希望收到:


$('a[title=“t”]')。每个(function(){//the

$('a[title=“t”])。每个(function(){//the

尝试一下,我认为它应该可以工作:

$('a[title="t"]').each(function() { // the <a> you want to look at
    var tr = $(this).parents('tr'); // the tr of this <a>
    tr.css({
        backgroundColor: $(this).attr('color') // set the color based on the <a>
    });
});​

试试这个,我认为它应该有用:

$('a[title="t"]').each(function() { // the <a> you want to look at
    var tr = $(this).parents('tr'); // the tr of this <a>
    tr.css({
        backgroundColor: $(this).attr('color') // set the color based on the <a>
    });
});​

你似乎链接到了一个空的JS提琴。我们不会为你做你的工作。我想要接收:你似乎链接到了一个空的JS提琴。我们不会为你做你的工作。我想要接收:谢谢,但这个工作不好:。我想要接收:谢谢,但这个工作不好:。我想要接收:但如何获得cu当前颜色?类似这样的东西:var color=$(this.nestest('tr')。(td:last”).css('color');但是如何获取当前颜色?类似这样的东西:var color=$(this.nestest('tr')。(td:last”).css('color');
$(this).closest('tr').css('background-color','your color');