I have a table and in each column it has a checkbox which has a class but no id or name. When the checkbox is checked or unchecked I am showing the checkbox state using an alert()
:
$(document).on('change', '[class*="box"]', function () {
var tableRow = $(this).closest('tr');
alert('check state ' + $("[class*='box']").is(':checked') ? 1 : 0);
});
My alert()
always returns 1
whether the checkbox is checked or unchecked. Maybe my coding approach could be wrong. Can anyone help to get the right state of checkbox? Thanks