如何列出 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());
});
以供参考 -http://plnkr.co/edit/zphkd8pVICzQ0zZRcOfn?p=preview http://plnkr.co/edit/zphkd8pVICzQ0zZRcOfn?p=preview
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)