Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Toggle all checkboxes in column of HTML table by TH header checkbox
$("th input[type='checkbox']").on("click",function(){
var col = $(this).parent().children().index($(this));
var checked = $(this).is(":checked");
$(this).closest("table").find("tr td:nth-child("+col+") input[type=checkbox]").prop("checked", checked);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.