I am attempting to make a check that once clicked will check all the boxes in that specific column of the table. So say if it was in column 3: when clicked it would check all the checkboxes that are in all the rows of column 3. But I also want it to detect which column it is in.
Here is what I have so far, I have got it to do one or the other but not both at the same time:
$('.checkall').click(
function(){
var col = $(this).parent().children().index($(this));
$(this).parent().parent().parent().parent().find("td:eq("+col+") input[type='checkbox']").attr('checked', $(this).is(':checked'));
}
);
This should work:
jsfiddle.net