Skip to content

Instantly share code, notes, and snippets.

@Swimburger
Last active April 8, 2016 14:40
Show Gist options
  • Save Swimburger/67d3bffda829acb2ad214811f09df0a5 to your computer and use it in GitHub Desktop.
Save Swimburger/67d3bffda829acb2ad214811f09df0a5 to your computer and use it in GitHub Desktop.
$('.js-table-checkable th :checkbox')
.off('click')
.on('change', function () {
var $this = $(this),
checked = $this.prop('checked'),
tr = $this.closest('.js-table-checkable')
.find('td :checkbox')
.prop('checked', checked)
.closest('tr');
if(checked){
tr.addClass('active');
}else{
tr.removeClass('active');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment