Good evening to those who read me, want to help me, I want to capture the values of a row of a table and display them in a modal
aui I have the table that comes from the database ...
<tbody id="myTable">
@foreach($actividades as $actividad)
<tr>
<td id="campId<?php echo $actividad->id; ?>">{{ $actividad->id }}</td>
<td id="campAct<?php echo $actividad->id; ?>">{{ $actividad->activiNomb }}</td>
<td id="campLog<?php echo $actividad->id; ?>">{{ $actividad->logNomb }}</td>
<td id="campCur<?php echo $actividad->id; ?>">{{ $actividad->curNomb }}</td>
<td align="right">
<?php echo $actividad->id ?>
<button id="{{ $actividad->id }}" type="button" value"<?php echo $actividad->id; ?>" class="edit btn-floating btn-small waves-effect waves-light blue" style="margin-top:-0.8em; margin-bottom:-0.8em; float: left;">
<i class="fa fa-pencil" style="font-size:30px; color:#f9791e"></i> </bottom>
</td>
<td align="left">
<form action="{{ action('ActividadesController@destroy', $actividad->id) }}" method="post">
@csrf
<input type="hidden" name="_method" value="DELETE"/>
<button type="submit" class="btn btn-link" style="margin-top:-0.8em; margin-bottom:-0.8em;"><i class="fa fa-remove" style="font-size:30px; color:#f9791e"></i></button>
</form>
</td>
</tr>
@endforeach
</tbody>
and here is the function that captures the data and puts them into the modal, which the problem is that I do not capture the id of the element and I put it empty
$(document).ready(function(){
$(document).on('click', '.edit', function(){
var pr= $('.edit').val();
var id=$(this).val();
console.log(pr);
var ids=$('#campId'+id).text();
var actividad=$('#campAct'+id).text();
// console.log(actividad);
var logro=$('#campLog'+id).text();
var curso=$('#campCur'+id).text();
$('#editModal').modal('show');
$('#modId').val(ids);
$('#modAct').val(actividad);
$('#modLog').val(logro);
$('#modCur').val(curso);
});
});