Skip to content

Instantly share code, notes, and snippets.

@surendrans
Created May 3, 2017 12:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save surendrans/a298adedb944f429dd80d3f9fdc8d9c2 to your computer and use it in GitHub Desktop.
Save surendrans/a298adedb944f429dd80d3f9fdc8d9c2 to your computer and use it in GitHub Desktop.
Select and Dselect
$(function(){
// add multiple select / deselect functionality
$("#selectall").click(function () {
$('.case').attr('checked', this.checked);
});
// if all checkbox are selected, check the selectall checkbox
// and viceversa
$(".case").click(function(){
if($(".case").length == $(".case:checked").length) {
$("#selectall").attr("checked", "checked");
} else {
$("#selectall").removeAttr("checked");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment