【问题标题】:jQuery Table Row Mouseover issuejQuery Table Row 鼠标悬停问题
【发布时间】:2013-09-03 01:54:58
【问题描述】:

我有以下代码:

$('table tr:not(:first)').mouseover(function() {
  $(this).removeClass('hovered_error');
    $(this).addClass('hovered');
  }).mouseout(function() {
  $(this).removeClass('hovered');
});

以上方法可以确保表格的第一行从“mouseover”和“mouseout”函数中排除。

但是,问题是我在页面上有多个表格,而第一个表格行被忽略,其余的则没有。

我不确定如何调整上述内容以考虑多个表 - 有可能吗?

【问题讨论】:

    标签: jquery html-table mouseover tablerow


    【解决方案1】:

    使用

    $('table tr:not(:first-child)').mouseover(function () {
        $(this).addClass('hovered');
    }).mouseout(function () {
        $(this).removeClass('hovered');
    });
    

    演示:Fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-12
      • 2012-07-14
      相关资源
      最近更新 更多