How can I get a specific row value of a table(for exampe third row of fifth column) using jquery. I tried:
var t = document.getElementById('table');
var val1 =$(t.rows[2].cells[4]).val();
alert(val1);
But it is showing nothing
Try using :eq() selector at this context
.val() is only applicable for input elements, you should use .text() instead to retrieve its text content,
var val1 =$(t).find('tr:eq(2) td:eq(4)').text();
alert(val1);
Or do,
alert($('#table tr:eq(2) td:eq(4)').text());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With