twitterfacebookgoogle plusrss feed

Pages

Friday, June 29, 2012

Multiple checkbox selection using JQuery


JQuery multiple checkbox selection is quite easy, simply put the following code and amend according to your choice

$("#maincheckbox").click(function() {
    $("input[type=checkbox]").attr("checked", this.checked);
});
 
$("input[rel=default]").click(function(){
    if($("input[rel=default]").length == $(".case:checked").length) {
        $("#maincheckbox").attr("checked", "checked");
    } else {
        $("#maincheckbox").removeAttr("checked");
    }
});


0 comments:

Post a Comment

comment or ask