Ciao, molto più semplicemente puoi fare cos'
codice HTML:
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$( "#all" ).change(function(e) {
console.log(e.target.checked)
$('.checkbox-item').attr('checked',e.target.checked)
});
});
</script>
</head>
<body>
<input type='checkbox' name='articoli[]' title = 'cosi' value='1' class="checkbox-item">
<input type='checkbox' name='articoli[]' title = 'cosi' value='2' class="checkbox-item">
<input type='checkbox' name='articoli[]' title = 'cosi' value='3' class="checkbox-item">
<input type='checkbox' title ='tutti' id="all">
</body>
</html>