I have the following code where I select all the checkboxes in a table.
Here is my table
<div class="table-responsive row">
<table id="TablaCargaOP" class="table table-bordered ">
<thead>
<tr class="bg-primary" id="EncabCargaOP">
<th width="5%">OP</th>
<th width="5%">Item</th>
<th width="18%">CodPza</th>
<th width="20%">Desc.</th>
<th width="5%">Cant.</th>
<th width="8%">Medidas.</th>
<th class="text-center" width="12%">Nivel</th>
<th width="8%">Pedido</th>
<th width="5%">
<div class="form-check">
<input type="checkbox" class="form-check-input" onchange="checkAll(this)" id="selectAll">
<label class="form-check-label"for="selectAll"> <i class="fa fa-arrows-v" aria-hidden="true"></i></label>
</div>
</th>
</tr>
</thead>
</table>
</div>
Method to select all the checkboxes.This method takes it out of here Fiddle
<script>
function checkAll(ele) {
var checkboxes = document.getElementsByTagName('input');
var celdas = $('#tableDespacho tbody > tr').find('td');
var status = $(celdas[7]).html();
if (ele.checked) {
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = true;
}
}
} else {
for (var i = 0; i < checkboxes.length; i++) {
console.log(i)
if (checkboxes[i].type == 'checkbox') {
checkboxes[i].checked = false;
}
}
}
}
</script>
What I want is to be able to add a condition if the state is found SI
this is not marked.