Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typescript/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 读取typescript中的所有表标题列名_Angular_Typescript_Angular6_Typescript2.0 - Fatal编程技术网

Angular 读取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

下面是我的表格结构。我想读取typescript中的所有表标记或标题列

<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")