My previous post was removed before I could add additional information but lets try this again...
Ive seen other posts similar to this but my adjustments have not been successful.
var table = document.getElementById("report-table");
var rows = table.getElementsByTagName("tr");
console.log(rows.length);
console.log(rows);
0
HTMLCollection []
length: 1077
My table is populated using Jquery+AJAX. I thought issue this might be because of script placement but I moved it to after the table is done filling and the result was the same.
EDIT
$.ajax({
url: 'test.php',
type: 'post',
data: {"order":order, "json":json},
success: function(json){
var js = Object.values(JSON.parse(json));
js = JSON.parse(json);
js.forEach(function(element){
var title = element['title'];
var date = element['date_stamp'];
$('#report-table').append('<tr class="report-item"><td> '+title+'</td><td>'+date+'</td></tr>');
});
}
});
var table = document.getElementById("report-table");
var rows = table.getElementsByTagName("tr");
console.log(rows.length);
console.log(rows);
HTML
<table class="report-table">
<tr class="report-head">
<th colspan="2">Report</th>
<th colspan="2" class="right">List By :
<select id="sort-select" onchange="sort(json)">
...
</select>
</th>
</tr>
</table>
<div class="my-table-responsive">
<table id="report-table" class="report-table">
</table>
</div>