This code is meant to do the simple task of:
a) Checking the checkbox that exists in the table's <tr>
row.
b) Adding the "selected" class to the <tr>
row.
While it does B without problem, I cannot get it to do A. I have tried every type of jQuery selector including input[name='checked_136'], 'input.action_items', etc. and I just can't get it to mark it as checked. I've also tried used thing attr('checked',true) to check it but that doesn't make a difference.
Does anyone have some insight?
$('table.dataset tbody tr').click(function () {
var this_row = $(this);
var checkbox = $(this).children('input.action_items');
if (checkbox) {
this_row.children(':checkbox').trigger('click');
this_row.addClass('selected');
}
});