Una Consulta, tengo la siguiente tabla:
<thead>
<th> Nombre y Apellido </th>
<th> Curso </th>
<th width="15%"> Division </th>
<th width="10%"> Ciclo Lectivo </th>
<th> </th>
<th> </th>
<tbody>
<?php foreach ($query as $registro): ?>
<tr>
<td > <?= $registro->persona_name ?> </td>
<td> <?= $registro->curso_anio ?> </td>
<td> <?= $registro->curso_division ?> </td>
<td width="15%"> <?= $registro->ciclolectivo?> </td>
<td> <?= anchor('alumno/editCurso/'.$registro->id,'<i class="icon-pencil"></i>'); ?> </td>
<th><input type="hidden" name="ver" value="<?= $registro->id?>"> </th>
</tr>
<?php endforeach; ?>
<tfoot>
<tr>
<th>nombre</th>
<th>curso</th>
<th>division</th>
<th>ciclolectivo</th>
</tr>
</tfoot>
y este es mi codigo js
$(document).ready(function() {
var oTable = $('#example').DataTable();
$('#example tbody').on( 'click', 'tr', function () {
$(this).toggleClass('selected');
var pos = oTable.row(this).index();
var row = oTable.row(pos).data();
console.log(row);
} );
$('#button').click( function () {
var oData = oTable.rows('.selected').data();
for (var i=0; i < oData.length ;i++){
r=oData[i][5].value();
alert(r);
}
} );
} );
¿Cómo puedo tomar solo el value del hidden que esta dentro de la tabla?
Gracias!!
id
y luego recuperar el valor por ese id:<input id="ibxHidden" type="hidden" ...>
y luegovar elHidden=$('#ibxHidden').val();
OJO, si tu elemento es este:oData[i][5]
estás recuperando mal el valor, deberías hacerlo así:r=oData[i][5].val();
– A. Cedano el 8 abr. 19 a las 14:08