小编Ama*_*nth的帖子

如何针对鼠标悬停事件上的元素 id 值进行测试?

想知道是否有人可以帮助我了解如何在鼠标悬停事件中针对元素的 ID 值进行测试。我假设我必须使用“这个”。

我为 ID 获得的值是“未定义”

function mouseOver() {
  var e = $(this).attr("ID"); //need help with this bit
  if (e == ("row2012")) {
    alert(e)
  } else {
    alert(e);
  }
}
Run Code Online (Sandbox Code Playgroud)
<table>
    <tr data-ng-repeat="x in Interruptions">
      <td id=row{{x.year}} onmouseover="mouseOver()" onmouseout="mouseOut()">
          {{x.year}}
      </td>
      <td>{{x.totalEvents}}</td>
      <td>{{x.customers}}</td>
      <td>{{x.avgDuration}}</td>
</table>
Run Code Online (Sandbox Code Playgroud)

html javascript jquery angularjs

1
推荐指数
1
解决办法
378
查看次数

标签 统计

angularjs ×1

html ×1

javascript ×1

jquery ×1