Skip to content

Instantly share code, notes, and snippets.

@suntong
Last active August 29, 2015 14:20
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 suntong/91fae43535138b9d25e5 to your computer and use it in GitHub Desktop.
Save suntong/91fae43535138b9d25e5 to your computer and use it in GitHub Desktop.
$(function () {
$("#selectall").click(function () {
$('.case').prop('checked', this.checked);
});
$(".case").click(function () {
if ($(".case").length == $(".case:checked").length) {
$("#selectall").prop("checked", true);
} else {
$("#selectall").prop("checked", false);
}
var sList = "";
$(".case:checked").each(function () {
sList += "(" + $(this).val() + "-" + (this.checked ? "checked" : "not checked") + ")";
});
$("#log").html(sList);
$("#s").html($(".case:checked").serialize());
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment