I have a table where I fill in the checkbox, before I ask if the user is in a permissions table, in case he finds me he checks the checkbox and if he does not leave it for me. Here my table
<table class="table table-striped" id="dataTable" width="100%" cellspacing="0">
<tr>
<th>Opcion</th>
</tr>
<?php if($query->num_rows>0):?>
<?php while ($r=$query->fetch_array()):?>
<?php $total = mysqli_num_rows(mysqli_query($conn,"SELECT Codigo from Maestro_PerfilUsuarios where Codigo = $persona->Codigo AND Acceso_CodMenu ='$r[Cod_Menu]'")); ?>
<tr>
<?php if ($total==0): ?>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" name="permiso[]" value="<?php echo $r[" Cod_Menu "] ?>" class="custom-control-input" id="<?php echo $id.$i; ?>">
<label class="custom-control-label" for="<?php echo $id.$i; ?>">
<?php echo $r["Opcion"] ?></label>
</div>
</td>
<?php else: ?>
<td>
<div class="custom-control custom-checkbox">
<input type="checkbox" name="permiso[]" value="<?php echo $r[" Cod_Menu "] ?>" class="custom-control-input" id="<?php echo $id.$i; ?>" checked>
<label class="custom-control-label" for="<?php echo $id.$i; ?>">
<?php echo $r["Opcion"] ?></label>
<button type="button" title="Quitar Permiso" name="btn_delete" onclick="QuitarPermiso()" class="close" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
</td>
<?php endif; ?>
<?php $i+=1; ?>
</tr>
<?php endwhile;?>
<?php endif;?>
</table>
Here is my javacritps where I get the text of a td
function QuitarPermiso() {
$('#dataTable tr').on('click', function() {
// var first = $(this).find('td:first').html();
var first = $(this).find('td:eq(0)').text();
alert(first);
});
}
What I want is to be able to get the value="<?php echo $r[" Cod_Menu "] ?>"
of an input on that td, how would I do it?