如何在jQuery中列出所有表头?我的HTML表格如下。
<table class="edit-table mobile-optimised break-words">
<thead>
<tr>
<th scope="col">Location</th>
<th scope="col">Date from/to</th>
<th scope="col">Qty of<br>places</th>
<th scope="col">Paid by £155.00 voucher<br>(net value)</th>
<th scope="col">Paid by card<br>(net value)</th>
</tr>
</thead>
<tbody>
<tr class="no-records"><td colspan="5">No records to display.</td></tr>
</tbody>
</table>
我想遍历每个,<th>
并获取每个的文本值。
您可以th
像下面这样迭代
$("table.edit-table thead tr th").each(function(){
console.log($(this).text());
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句