I have this table created with the% co_from% a% co_from%
is used<table class="table table-bordered">
<tbody>
@foreach($usuarios as $key => $tag)
<tr id="caputracorreo" data-userid="{{$tag->email}}">
<td>{{ ++$key }}</td>
<td>{{ $tag->name }}</td>
<td>{{ $tag->email}}</td>
<td> <select class="form-control" id="estadoactualiza" name="estadoactualiza" data-userid="{{$tag->email}}" onchange="actualizar(this)">
@foreach($estados as $estado)
@if ($estado->id == $tag->id_estado)
<option selected value="{{$estado->id}}">{{$estado->nombre}}</option>
@else
<option value="{{$estado->id}}">{{$estado->nombre}}</option>
@endif
@endforeach
{{ csrf_field() }}
</select>
</td>
</tr>
@endforeach
</tbody>
</table>
{{ $usuarios->links('vendor.pagination.paginadorusuarios') }}
and I have this js with the action of laravel 5.3
<script type="text/javascript">
function actualizar() {
var id_estado = document.getElementById("estadoactualiza").value;
var userid = $(caputracorreo).data('userid');
alert (userid);
}
</script>
You want to get the foreach
previous% of onchange
, but always return the first email, let's say the first td
mail.