Change tr background-color

后端 未结 7 1414
刺人心
刺人心 2021-02-04 04:36

I have something like this:

\' onclick=\"SetBackgroundColor(this)\" style=\"background-color:Yellow\">

Whe

7条回答
  •  太阳男子
    2021-02-04 05:15

    IE has a problem with background colors for the TR element. A more safe way is to set background to the TD's and TH's inside the TR:

    testcell

    Added: you can assign a single event handler for the entire table to increase performance:

    $('#tabletest').bind('click', function(e) {
        $(e.target).closest('tr').children('td,th').css('background-color','#000');
    });
    

提交回复
热议问题