I want to create list in JS and it must be populated by 'string' object by checking checkboxes near that particular string. Also, when the checkbox is unchecked, that particular string must be removed from list.
Kindly help me build this piece of code.
<div class="row panel panel-default c-panel">
<div class="panel-heading c-phead">LIST</div>
<div class="panel-body">
<table class="table table-striped" id="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Customer</th>
<th scope="col">Checked/Unchecked</th>
</tr>
</thead>
<tbody>
<c:forEach items="${values}" varStatus="status" var="allval">
<tr>
<td>${status.index + 1}</td>
<td>${getVlaue1()}</td>
<td>${getVlaue2()}</td>
<td>
<input type="checkbox" class="custom-control-input" id="check1" value="${getVlaue1()}">
</td>
</tr>
</c:forEach>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
SCRIPT >>
$(document).ready(function(){
$('#check1').click(function(){
});
$('#table').DataTable();
});
java?