this refers to the tr element in the if block, since your b_partner_id attribute is b_partner_id present in the tr element, which you get undefined .
Instead, you need to get the attribute value using the checkbox link
$('#mytable').find('tr').each(function () { var row = $(this), $check = row.find('input[type="checkbox"]'); if ($check.is(':checked')) { alert($check.attr("b_partner_id")); } });
source share