How can you get all rows in a table without getting the rows in child tables?
var rows = $(\'tr\', tbl);
This will return ALL It works, because the selector will return a HTMLTableElement object. Probably: If you just want the count of rows, you can simply use: Or you can use direct children selector: The child selector will get the table's If you already have a table object: Or: Here is a working example.
var count = $('#tableID').rows;
var rows = $("#tableid>tr");
var table = document.getElementById('tableID');
table.rows.length;
$('table > tbody > tr').each(function(index, tr) {} );
var rows = $('#tblID > tbody > tr')
<tbody>
element and consequently get the <tr>
elements that are direct children of the table's tbody.var rows = $(tbl).find('> tbody > tr');
var rows = $(tbl).children('tbody').children('tr');