How to select all, not all, in the latest version of jquery.

in learning sharp jquery,
I encountered a problem when I introduced the old version of jquery (version 1.71 in the book) and the latest version of jquery when the structure and content of html were the same.
has a total of four check boxes, which worked normally in older versions of jquery.
however, in the new version, if you do not manually click the check box to change the check state, both the select all and not all buttons will work;
when I manually click the check box to change its status, both the select all and not all buttons will not work for the check boxes I have clicked. You can only manually click the check box to toggle the selected state.

Why is this happening? Is there any solution? Thank you.

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
 <!--   jQuery -->
<script src="../../scripts/jquery.js" type="text/javascript"></script>
 <script type="text/javascript">
  $(function(){
     //
     $("-sharpCheckedAll").click(function(){
         $("[name=items]:checkbox").attr("checked", true);
     });
     //
     $("-sharpCheckedNo").click(function(){
        $("[type=checkbox]:checkbox").attr("checked", false);
     });
     
  })

  </script>
</head>
<body>
<form method="post" action="">
   
   <br/>
    <input type="checkbox" name="items" value=""/>
    <input type="checkbox" name="items" value=""/>
    <input type="checkbox" name="items" value=""/>
    <input type="checkbox" name="items" value=""/>
   <br/>
    <input type="button" id="CheckedAll" value=""/>
    <input type="button" id="CheckedNo" value=""/>

</form>
</body>
</html>
Feb.28,2021

change it to this

$("-sharpCheckedAll").click(function(){
         $('[name=items]:checkbox').prop('checked', true);
     });
     //
     $("-sharpCheckedNo").click(function(){
        $('[type=checkbox]:checkbox').prop('checked', false);
     });
Menu