How check single or All checkboxes in jquery?

onClick Checkbox check all checkboxes jquery

File name : index.php

<!DOCTYPE html>
<html>
<body>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<input type="checkbox" id="checkAll">Select All<br>
<input type="checkbox" id="checkItem">Item 1<br>
<input type="checkbox" id="checkItem">Item 2<br>
<input type="checkbox" id="checkItem">Item 3<br>
<input type="checkbox" id="checkItem">Item 4<br>
<input type="checkbox" id="checkItem">Item 5<br>
<script>
$("#checkAll").click(function () {
$('input:checkbox').not(this).prop('checked', this.checked);
});
</script>
</body>
</html>

Output :-

Select All
Item 1
Item 2
Item 3
Item 4
Item 5





Previous Next


Trending Tutorials




Review & Rating

0.0 / 5

0 Review

5
(0)

4
(0)

3
(0)

2
(0)

1
(0)

Write Review Here