我有一个标准的HTML表,但是我似乎找不到任何东西来立足并开始使用。 我的桌子是这样的:
<div id="seriesDiv" style="margin-top: 0px;">
<table class="tableFile2" summary="Results">
<tbody><tr>
<th scope="col" width="7%">Filings</th>
<th scope="col" width="10%">Format</th>
<th scope="col">Description</th>
<th scope="col" width="10%">Filing Date</th>
<th scope="col" width="15%">File/Film Number</th>
</tr>
<tr>
<td nowrap="nowrap">4</td>
<td nowrap="nowrap"><a href="/Archives/edgar/data/1087294/000120919119051031/0001209191-19-051031-index.htm" id="documentsbutton"> Documents</a></td>
<td class="small">Statement of changes in beneficial ownership of securities<br>Acc-no: 0001209191-19-051031 Size: 9 KB </td>
<td>2019-09-27</td>
<td></td>
</tr>
<tr class="blueRow">
<td nowrap="nowrap">4</td>
<td nowrap="nowrap"><a href="/Archives/edgar/data/1087294/000120919119050363/0001209191-19-050363-index.htm" id="documentsbutton"> Documents</a></td>
<td class="small">Statement of changes in beneficial ownership of securities<br>Acc-no: 0001209191-19-050363 Size: 50 KB </td>
<td>2019-09-20</td>
<td></td>
</tr>
那么标准的东西-表格,表体,trs和tds
我尝试过
var rows = $("#seriesDiv").find("table");
console.log("in front loop ", rows.length);
for (var i = 0; rows.length; i++) {
console.log("inside loop");
}
我尝试过:
var rows = $(".tableFile2").find("tr");
```
Can someone please show me how to do this? I want to loop through TRs, and for each TR, I want to loop through TDs.
thank you
答案 0 :(得分:1)
下面的代码将帮助您遍历每个tr。另外,请注意,如果只为每个“ tr”寻找“ tds”,则不会找到“ th”。因此,您还必须寻找“ ths”。请注意,以下代码仅是示例。因此,没有错误检查或数据评估之类的东西。
<View>