I'm trying to get the contents of every TD element (there are 5 of them) in a table with index 0 that has matching classes. To do this, I wrote this:
- $("tr.dataTableRow>td:eq(0)").each(function (i) {
- items[i] = $.trim($(this).text());
- });
This results in only the first element's values being returned. Doing:
- console.log($("tr.dataTableRow>td:eq(0)").length);
...gives me only "1" but I know there are 5 such elements that should match. So, I tried rewriting it like this and it gave me all five:
- $("td:eq(0)", $("tr.dataTableRow")).each(function (i) {
- items[i] = $.trim($(this).text());
- });
Why can't I select all the index 0 TD elements under those TR elements using a single query string?