Angular 读取typescript中的所有表标题列名
下面是我的表格结构。我想读取typescript中的所有表标记或标题列Angular 读取typescript中的所有表标题列名,angular,typescript,angular6,typescript2.0,Angular,Typescript,Angular6,Typescript2.0,下面是我的表格结构。我想读取typescript中的所有表标记或标题列 <table> <tr> <th>name</th> <th>dob</th> </tr> </table> 请大家在这里帮忙 这将获取所有表头元素,循环设置不同的类等。您好,感谢回复,同一页面中有两个表,因此我们将获取所有标记。您可以为表提供类或id吗。这样,您可以选择“.classname th”或“#id th” docu
<table>
<tr>
<th>name</th>
<th>dob</th>
</tr>
</table>
请大家在这里帮忙
这将获取所有表头元素,循环设置不同的类等。您好,感谢回复,同一页面中有两个表,因此我们将获取所有标记。您可以为表提供类或id吗。这样,您可以选择“.classname th”或“#id th”
document.getElementById("name").className = "defaultSort";
document.getElementById("dob").className = "defaultSort";
document.querySelectorAll("#uniqueTableName th")