I'm Trying to check all elements if checkbox input type, I tried different solutions but it didn't work, I know this is simple, but I don't know what is wrong with my code:
<ul class="items">
<li class="item checkall">
<label>
<input type="checkbox" name="item[]" id="checkAll">
<span></span>
<p>Check All Items</p>
</label>
</li>
<li class="item">
<label>
<input type="checkbox" name="item[]" id="checkbox" value="1">
<span></span>
<p>Learn HTML5.1</p>
</label>
</li>
<li class="item">
<label>
<input type="checkbox" name="item[]" id="checkbox" value="2">
<span></span>
<p>Learn PHP7</p>
</label>
</li>
<li class="item">
<label>
<input type="checkbox" name="item[]" id="checkbox" value="4">
<span></span>
<p>Program a Website</p>
</label>
</li>
</ul>
jQuery :
$(".checkall").click(function () {
$('input:checkbox').not(this).prop('checked', this.checked);
});