Select All checkboxes using jQuery

前端 未结 15 1631
渐次进展
渐次进展 2020-12-05 06:26

I have the following html code:

    
    

15条回答
  •  臣服心动
    2020-12-05 06:49

    Use prop

    $(".checkBoxClass").prop('checked', true);
    

    or to uncheck:

    $(".checkBoxClass").prop('checked', false);
    

    http://jsfiddle.net/sVQwA/

    $("#ckbCheckAll").click(function () {
        $(".checkBoxClass").prop('checked', $(this).prop('checked'));
    });
    

    Updated JSFiddle Link: http://jsfiddle.net/sVQwA/1/

提交回复
热议问题