先看下面代码:

name sex age
Henry male 30
Emily female 30
上面是含有change事件的表格,下面是change事件的实现 function onChange(id){ $("input[name='tdCheckBox']").removeAttr('checked'); id.checked = true; console.log(id.checked) var name= id.parentNode.parentNode.children[1].textContent; console.log(name); } 重点是id.parentNode.parentNode.children[1].textContent; 获取对象的内容,也可使使用innerHTML; 主要是children的使用可以获取指定行的对象。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
猜你喜欢
  • 2022-02-21
  • 2021-06-25
  • 2021-12-03
  • 2021-10-21
  • 2022-12-23
  • 2022-02-01
  • 2021-11-29
相关资源
相似解决方案