Change tr background-color

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

I have something like this:

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

Whe

7条回答
  •  迷失自我
    2021-02-04 05:14

    This will reset each row upon clicking a new one...

    $(document).ready(function(){
    
      $('tr').click(function(){
        $('tr td').css({ 'background-color' : 'green'});
        $('td', this).css({ 'background-color' : 'red' });
      }); 
    
    });
    

    demo: http://jsbin.com/aciqi/

提交回复
热议问题