Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67497

How to pass variable value for table.rows.cells to get table cell value?

$
0
0

I am facing a difficulty in passing variable for a cell value to get the content in the table cell. Passing the row variable will detect but not the col variable.

var col = $(this).parent().children().index($(this));
var row = $(this).parent().parent().children().index($(this).parent());
//displaying row and col variables do work.
//This is the result I am getting <button style="display:block; width: 100%;">Actual Cell Value</button>
var cellValue;
cellValue = document.getElementById("dataTable").rows[row].cells[col].innerHTML;
alert(cellValue);

//This one returns correct cell value
alert(document.getElementById("dataTable").rows[row].cells[0].innerHTML);

Viewing all articles
Browse latest Browse all 67497

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>