Jquery select all if not disabled

后端 未结 4 689
遥遥无期
遥遥无期 2020-12-18 21:46

I am using the following script to select all checkboxes with a given class.

$(document).ready(function(){ // 1
    // 2
    $(\':checkbox.selectall\').on(\'         


        
4条回答
  •  误落风尘
    2020-12-18 22:02

    This does not do the same as your original code. It would only trigger change for those that was not changed. I've assummed you wished to trigger change for all the once you changed

    $(':checkbox.selectall').on('click', function(){
            $(':checkbox .'+ $(this).data('checkbox-name')).not(':disabled').prop("checked", $(this).prop("checked")).trigger("change");
        });
    

提交回复
热议问题