如何使用jQuery处理表的行更改事件? [英] how to handle row change event of table using jquery?

查看:99
本文介绍了如何使用jQuery处理表的行更改事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有包含多行的简单HTML表.我要离开的行.如何处理行离开或行更改事件并获取我要离开的行的ID?

I have simple HTML table having multiple rows. I want to get row that I am leaving. How to handle row leave or row change event and get id of the row that I am leaving??

谢谢.

推荐答案

使用.hover()方法,第一个函数是鼠标进入的处理程序,第二个函数是鼠标离开的处理程序

Use the .hover() method, the first function is the handler of the mouse entering, the second handles the mouse leave

//considers all rows except the first (usually used for headers)
$("tr").not(':first').hover(
  function () {
    //handles mouseenter
  }, 
  function () {
    //handles mouseleave
  }
);

您可以在处理程序中使用$(this)来引用要离开/进入的当前行

You can use the $(this) inside the handlers to refer to the current row that you're leaving / entering

这篇关于如何使用jQuery处理表的行更改事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆