【发布时间】:2014-07-18 10:48:26
【问题描述】:
当我连续单击一个img时使用JQuery,是否可以更改所选行的背景颜色?
谢谢
更新
$('.myLink').click(function() {
$("#User tbody tr").on('click', function (event) {
$("#User tbody tr").removeClass('highlightRow');
(this).addClass('highlightRow');
});
$.ajax({
...
});
});
这允许我在单击该行时添加类。我只想在单击图像时在行上添加类。
<table id="User" style="width: 100%;">
<thead>
<tr>
<th>View Information</th>
</tr>
</thead>
<tbody>
@foreach (var userinfo in Model)
{
<tr>
<td>
<img src="/Images/SilkIcons/information.png" alt="Click for more details" class="myLink" title="@userinfo.userID"/>
</td>
</tr>
}
</tbody>
</table>
【问题讨论】:
-
能否也发布您的 HTML 代码?
-
是的,这实际上是可能的! :) 没有任何代码就帮不上忙了!
-
使用此代码
img选中行的点击事件
标签: jquery datatables