<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet">
<div class="container mt-5">
<h3>Bootstrap Get Checkbox checked value</h3>
<input class="form-check-input" type="checkbox" id="checkbox1" value="value1">
<label class="form-check-label" for="checkbox1">
<input class="form-check-input" type="checkbox" id="checkbox2" value="value2">
<label class="form-check-label" for="checkbox2">
<input class="form-check-input" type="checkbox" id="checkbox3" value="value3">
<label class="form-check-label" for="checkbox3">
<input class="form-check-input" type="checkbox" id="checkbox4" value="value4">
<label class="form-check-label" for="checkbox4">
<input class="form-check-input" type="checkbox" id="checkbox5" value="value5">
<label class="form-check-label" for="checkbox5">
<button id="getCheckedValues" class="btn btn-primary mt-3">Get Checked Values</button>
<div id="checkedValuesContainer" class="mt-3"></div>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.bundle.min.js"></script>
$(document).ready(function () {
$('#getCheckedValues').click(function () {
$('input.form-check-input:checked').each(function () {
checkedValues.push($(this).val());
$('#checkedValuesContainer').text('Checked Values: ' + checkedValues.join(', '));