Html 如果选中复选框,则循环表行并返回列值

Html 如果选中复选框,则循环表行并返回列值,html,jquery,Html,Jquery,如果使用jquery选中了该行的复选框,我如何才能只获取序列列中的值?我目前可以获得序列值,但不确定如何添加复选框条件 Html: 有一百万种方法可以做到这一点,但希望这是有用的 解决方案的要点是循环遍历每一行,然后在选中同一行的复选框后只记录第二列的文本 $('#usersTable > tbody > tr').each(function() { const currentRow = $(this); const lastColumn = currentRow.find

如果使用jquery选中了该行的复选框,我如何才能只获取序列列中的值?我目前可以获得序列值,但不确定如何添加复选框条件

Html:


有一百万种方法可以做到这一点,但希望这是有用的

解决方案的要点是循环遍历每一行,然后在选中同一行的复选框后只记录第二列的文本

$('#usersTable > tbody  > tr').each(function() {
  const currentRow = $(this);
  const lastColumn = currentRow.find('td:last-child')

  if (lastColumn.find('input').attr('checked')) {
    console.log(currentRow.find('td:nth-child(2)').text());
  }
});

您可能需要检查此链接outconsole.log$this.find'input'.is':checked'//返回true或false
$('#usersTable > tbody  > tr').each(function (index, tr) {
      console.log($(this).find('td:nth-child(2)').text());

 });
$('#usersTable > tbody  > tr').each(function() {
  const currentRow = $(this);
  const lastColumn = currentRow.find('td:last-child')

  if (lastColumn.find('input').attr('checked')) {
    console.log(currentRow.find('td:nth-child(2)').text());
  }
});