Change tr background-color

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

I have something like this:

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

Whe

相关标签:
7条回答
  • 2021-02-04 05:18

    A simpler solution is to probably use a selector for all rows in the table or addClass.

    Example

    $("#myTable tr").click(function() {
        $(this).css('background-color', '#f00');
    });
    

    or

    $("#myTable tr").click(function() {
        $(this).addClass('selected');
    });
    
    0 讨论(0)
提交回复
热议问题