0

これを理解するのに苦労しています。2 番目と 3 番目の両方のチェックボックスがオフになっている場合tdは、4 番目のチェックボックスを無効にします。

$('#allergies tbody tr').each(function () {
  if ($('td:eq(1) input[type="checkbox"]:not(:checked)', $(this)).length > 0 
      && $('td:eq(2) input[type="checkbox"]:not(:checked)', $(this)).length > 0) {
      $("td:eq(3) input", $(this)).attr('disabled', false);
  }
});
4

2 に答える 2

1
$('#allergies tbody tr').each(function () {
  if ($('td:eq(1) input[type="checkbox"]:not(:checked)').length > 0 
      && $('td:eq(2) input[type="checkbox"]:not(:checked)').length > 0) {
      $("td:eq(3) input").prop('disabled', true);
  }
});

tr 使用の特定のものに

$('#allergies tbody tr').each(function () {
  if ($('td:eq(1) input[type="checkbox"]:not(:checked)', $(this)).length > 0 
      && $('td:eq(2) input[type="checkbox"]:not(:checked)', $(this)).length > 0) {
      $("td:eq(3) input", $(this)).prop('disabled', true);
  }
});
于 2012-11-01T16:45:20.007 に答える