jeudi 24 novembre 2016

td value from another td in onchange select in foreach loop in pagination laravel 5.3

i have this table with foreach loop with pagination in laravel 5.3

<table class="table table-bordered">

                  <tbody>
                    @foreach($usuarios as $key => $tag)
                      <tr id="caputracorreo" data-userid="">
                        <td></td>
                        <td></td>
                        <td></td>


                        <td> <select class="form-control" id="estadoactualiza" name="estadoactualiza" data-userid="" onchange="actualizar(this)">
                          @foreach($estados as $estado)
                            @if ($estado->id == $tag->id_estado)
                             <option selected value=""></option>
                            @else
                            <option value=""></option>
                             @endif
                          @endforeach
                          
                        </select>
                      </td>
                      </tr>
                    @endforeach
                  </tbody>
                </table>

                

and this js

function actualizar() {
  var id_estado = document.getElementById("estadoactualiza").value;
  var userid = $(caputracorreo).data('userid');
  alert (userid);
}

the problem is that returns only the first value in each select



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire