Skip to content

Instantly share code, notes, and snippets.

@23maverick23
Last active October 12, 2015 03:58
Show Gist options
  • Save 23maverick23/3967550 to your computer and use it in GitHub Desktop.
Save 23maverick23/3967550 to your computer and use it in GitHub Desktop.
JavaScript: Highlight table row when checked
/*
* Highlight table rows when checkbox is checked.
*/
$("tbody>tr").filter(":has(:checkbox:checked)").addClass("success").end().click(function(event) {
$(this).toggleClass("success");
if (event.target.type !== "checkbox") {
$(":checkbox", this).attr("checked", function() {
return !this.checked;
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment