Sayfalar

20 Mayıs 2017 Cumartesi

Get index of table cell td, set spessific cell of table

html - How to set table cell value using jquery jquery - Chaaanging table cell contents

jQuery set value on specific table cell 

    var row_index = $(this).parent().index('tr');

    var col_index = $(this).index('tr:eq('+row_index+') td');


var col_index = $(this).prevAll().length;
var row_index = $(this).parent('tr').prevAll().length;

var col_index = $(this).closest("td").index();
var row_index = $(this).closest("tr").index();


$('table#table_header tr:nth-child(' + row_index + ') td:nth-child(' + col_index + ')').html('bla bla bla');