Jquery 行选中背景色

直接上代码:

懒得以后网上在查了,拷贝直接可用


Style:

.tbSelectCss {
    background-color:#d5f4fe;

}


Html:

<table name="UserTb" class="sanjhb_table border_r3px sanjhb_table2" width="100%" border="0" cellspacing="0" cellpadding="3">
            <tr>
                <td width="50"> </td>
                <td width="120" align="left">工地名称</td>
                <td width="120" align="left">工地编号</td>
            </tr>
<span style="white-space:pre">		</span><tr>
<span style="white-space:pre">		</span><td align="left">@item.name_CN</td>
<span style="white-space:pre">		</span><td align="left">@item.sNo</td>
<span style="white-space:pre">		</span><td align="left">@item.WD_SiteType.name_CN</td>
<pre name="code" class="html"><span style="white-space:pre">		</span></tr>


Script:

$('table[name="UserTb"] tr').click(function () {
        $(this).addClass("tbSelectCss");
        $(this).siblings().removeClass("tbSelectCss");

    })


原文地址:https://www.cnblogs.com/hanjun0612/p/9779895.html