retrieve value cell table with javascript

-2

I would like to retrieve the value of the cells in the first column of a table. The table has a button in the last column with which I open a modal and I want to show the idClient corresponding to that row. I'm pretty stuck in javascript, really. I have tried some example but I only recover the first row, if I press on the button of the second one it does not paint anything.

Thanks in advance!

    
asked by Oscar Marés Barrera 24.05.2018 в 23:09
source

1 answer

0

After a lot of trying I have already achieved it, I was doing a function that with the click of a button event I was trying to recover. I finally did this and it worked for me. $(document).ready(inicio);

function inicio(){

   // $("#btnfactura").click(valores);
   $('#tablaCliente tr').on('click', function(){
  var dato = $(this).find('td:first').html();
  $('#idCliente').val(dato);
});

}

Thank you very much

    
answered by 24.05.2018 в 23:25