As I didn\'t find any question asked before, on how to toggle checkbox on click of a table row, so I would like to share my approach to this...
Triggering a click like many of the solutions provided above will cause the function to run twice. Update the prop value instead:
$('tr').click(function(event){
alert('function runs twice');
if(event.target.type !== 'checkbox'){
//$(':checkbox', this).trigger('click');
// Change property instead
$(':checkbox', this).prop('checked', true);
}
});
Link to jsfiddle example here