I'm using javascript
on a "Mark All" button to mark all% of my system%, but now I'd like to mark only the checkbox
of a specific block or a specific company that defines each block . Companies are being listed through a loop, I can not just mark the checkboxes of a specific company, it's marking them all.
Does anyone have a solution? Thanks in advance!
/* Lista Empresas */
foreach($listarempresa as $empresa){
$listaremail = listarEmails($conexao,$empresa["empresaid"]);
?>
<!--Oculta Elementos-->
<script>
$(document).ready(function(){
$("#empresa<?=$empresa["empresaid"]?>").css("display", "none");
});
</script>
<div class="collection">
<a href="#!" class="collection-item" data-element="#empresa<?=$empresa["empresaid"]?>" style="color:#005129; font-size:13px;"><?=$empresa["empresa"]?><span class="badge">
<?=totalEmail($conexao,$empresa["empresaid"])?></span></a></div>
<div id="empresa<?=$empresa["empresaid"]?>">
<?php
$i = 0;
?>
<!-- Lista Emails de uma Empresa especifica através da chave empresaid -->
<?php foreach($listaremail as $emails){
if($empresa["empresaid"] == $emails["empresaid"]){?>
<p>
<input type="checkbox" name = "email<?=$i?>[]" value="<?=$emails["endemail"]?>" id="teste5<?=$i?>" />
<label for="teste5<?=$i?>" style="font-size:13px"><?=$emails["nome"]." ("?><?= $emails["endemail"].")"?></label>
</p>
<?php $i++; }?>
<?php } ?>
<div class="switch">
<!-- Botão Marcar Todos -->
<label>
<input type="checkbox" onclick="marcarTodos(this.checked);" name="email0[]" id="teste5<?=$i?>">
<span class="lever"></span>
<label for="checkall" style="font-size:14px;"></label>
</label>
</div>
</div>
<?php
}
I would like it to mark only the emails listed according to the company, and it is marking all emails from all companies.
/* Lista Empresas */
foreach($listarempresa as $empresa){
$listaremail = listarEmails($conexao,$empresa["empresaid"]);
?>
<!--Oculta Elementos-->
<script>
$(document).ready(function(){
$("#empresa<?=$empresa["empresaid"]?>").css("display", "none");
});
</script>
<div class="collection">
<a href="#!" class="collection-item" data-element="#empresa<?=$empresa["empresaid"]?>" style="color:#005129; font-size:13px;"><?=$empresa["empresa"]?><span class="badge">
<?=totalEmail($conexao,$empresa["empresaid"])?></span></a></div>
<div id="empresa<?=$empresa["empresaid"]?>">
<?php
$i = 0;
?>
<!-- Lista Emails de uma Empresa especifica através da chave empresaid -->
<?php foreach($listaremail as $emails){
if($empresa["empresaid"] == $emails["empresaid"]){?>
<p>
<input type="checkbox" name = "email<?=$i?>[]" value="<?=$emails["endemail"]?>" id="teste5<?=$i?>" />
<label for="teste5<?=$i?>" style="font-size:13px"><?=$emails["nome"]." ("?><?= $emails["endemail"].")"?></label>
</p>
<?php $i++; }?>
<?php } ?>
<div class="switch">
<!-- Botão Marcar Todos -->
<label>
<input type="checkbox" onclick="marcarTodos(this.checked);" name="email0[]" id="teste5<?=$i?>">
<span class="lever"></span>
<label for="checkall" style="font-size:14px;"></label>
</label>
</div>
</div>
<?php
}