jQuery Checkboxes

前端 未结 4 1702
长发绾君心
长发绾君心 2021-02-08 04:27

I\'m trying to write a piece of jQuery code where, if all checkboxes are \"unchecked\", then all li tags have the class \"disabled.\"

But, if one checkbox (any checkbox)

4条回答
  •  悲哀的现实
    2021-02-08 04:49

    $(':checkbox').click(function () {
        $('li').toggleClass('disabled', !$(':checkbox:checked').length);
    });
    

提交回复
热议问题