javascript - Find if checkbox is cheked in tr -
i have problem determining if checkbox checked in parent tr. if checkbox cheked tr shoud skiped. seemed correct in code,but it's not working.
$(document).ready(function () { var sum = 0; $('#maincontent_gvorders > tbody > tr > td .col1').each(function () { if ($(this).closest('tr').has('input:not(:checked)')) { sum += parseint($(this).text()); } }); $('#tp').html(sum); }); function pageload(sender, args) { var sum = 0; $('#maincontent_gvorders > tbody > tr > td .col1').each(function () { if ($(this).closest('tr').has('input:not(:checked)')) { sum += parseint($(this).text()); } }); $('#tp').html(sum); }
you can using below code.
$('#maincontent_gvorders tr:has("input:not(:checked)")').filter(function(){ return sum += parseint($(this).find('td').text(), 10); });
Comments
Post a Comment