Please see code below:

//Converted Code with Class
$(document).ready(function () {
    $('.chk-all-s input:checkbox').click(function () {
        var cb = $(this),
            name = cb.attr('check-all-for');

        if (name == null)
            return false;

        $('.chkAll input:checkbox[name^=' + name + ']').prop('checked', cb.prop('checked')).click(function () {
                if (!$(this).prop('checked'))
                    cb.prop('checked', false);
            });
    });


    $('input[type=checkbox][class!=chk-all-s]').click(function () {
        var cb = $(this),
            name = cb.attr('name');

        if (name == null)
            return false;
       var allChildrenChecked = true;
       $('input[type=checkbox][name^=' + name + ']').each(function () {
           if (!$(this).prop('checked')) {
              allChildrenChecked = false;
                return;
            }
        });
        $('input[type=checkbox][check-all-for^=' + name + ']').prop('checked', allChildrenChecked);
    });

});




//Original Code - this is working fine

//$(document).ready(function () {
//    $('input[type=checkbox][class=chk-all-s]').click(function () {
//        var cb = $(this),
//            name = cb.attr('check-all-for');

//        if (name == null)
//            return false;

//        $('input[type=checkbox][name^=' + name + ']')
//            .prop('checked', cb.prop('checked'))
//            .click(function () {
//                if (!$(this).prop('checked'))
//                    cb.prop('checked', false);
//            });
//    });
//    $('input[type=checkbox][class!=chk-all-s]').click(function () {
//        var cb = $(this),
//            name = cb.attr('name');

//        if (name == null)
//            return false;
//        var allChildrenChecked = true;
//        $('input[type=checkbox][name^=' + name + ']').each(function () {
//            if (!$(this).prop('checked')) {
//                allChildrenChecked = false;
//                return;
//            }
//        });
//        $('input[type=checkbox][check-all-for^=' + name + ']').prop('checked', allChildrenChecked);
//    });

//});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="col col-7">
  <div class="chk-all-con">
    <input type="checkbox" id="chkall1" class="chk-all-s" check-all-for="approve" />
    <label class="lbl-chkall" for="chkall1">Inline same row</label>
  </div>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall2" type="checkbox" name="approve" class="chkAll">
  <label class="lbl-chkall" for="chkall2">Check me</label>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall3" type="checkbox" name="approve" class="chkAll">
  <label class="lbl-chkall" for="chkall3">Check me</label>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall4" type="checkbox" name="approve" class="chkAll">
  <label class="lbl-chkall" for="chkall4">Check me</label>
</div>

<hr>


<div class="col col-7">
  <div class="chk-all-con">
    <input type="checkbox" id="chkall5" class="chk-all-s" check-all-for="disapprove" />
    <label class="lbl-chkall" for="chkall5">Inline same row</label>
  </div>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall6" type="checkbox" name="disapprove" class="chkAll">
  <label class="lbl-chkall" for="chkall6">Check me</label>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall7" type="checkbox" name="disapprove" class="chkAll">
  <label class="lbl-chkall" for="chkall7">Check me</label>
</div>

<div class="chk-all-con chk-all-without-text chk-without-lbl">
  <input id="chkall8" type="checkbox" name="disapprove" class="chkAll">
  <label class="lbl-chkall" for="chkall8">Check me</label>
</div>

Hi guys just a newbie in jquery, I tried adding a class on my code however, it’s not working anymore. As you can see the original code below is working fine and currently, the code I converted is not working can you please teach me what is the correct way to convert it. Thanks in advance guys

2