I used this page to create this code https://getbootstrap.com/docs/5.0/forms/checks-radios/#indeterminate
When I click the checkbox with id=(flexCheckIndeterminate), all the checkboxes below it will be selected, and click it again, all the checkboxes below it will be canceled.
How to do it via JS without using jQuery?
<!doctype HTML>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css"
rel="stylesheet" integrity="sha384-
EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<h2>Bootstrap Table Checkbox Select All and Cancel</h2>
<div class="container">
<table class="table table-bordered table-hover" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>
<div class="form-check">
<input class="form-check-input" type="checkbox" value=""
id="flexCheckIndeterminate">
<label class="form-check-label" for="flexCheckIndeterminate">
</label>
</div>
</th>
<th>#</th>
<th >Name</th>
<th > ID</th>
<th >Date & Time</th>
<th >Check-in</th>
</tr>
</thead>
<tbody>
<tr>
<td><div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck1">
<label class="form-check-label" for="defaultCheck1">
</label>
</div>
</td>
<td>1</td>
<td>Safaa</td>
<td>20421</td>
<td>12/2/2021 16:40</td>
<td>Yes</td>
</tr>
<tr>
<td><div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="defaultCheck2">
<label class="form-check-label" for="defaultCheck2">
</label>
</div>
</td>
<td>2</td>
<td>Noor</td>
<td>19091</td>
<td>15/2/2021 16:40</td>
<td>No</td>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Optional JavaScript; choose one of the two! -->
<!-- Option 1: Bootstrap Bundle with Popper -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
</body>
</html>