我想更改此表格中“开始日期”列的innerText。如何更改表格上某一列的内容?
下面的代码:
<tr id="currentRow">
<th>Name</th>
<th>Position</th>
<th>Office</th>
<th>Age</th>
<th>Start date</th>
<th>Salary</th>
</tr>
我想下面这段代码,但没有奏效。
document.getElementById("currentRow").td[4] = "this is a text";
我该如何实现它?
但getElementById不适合我,querySelectorAll正在工作。 – djmayank
可能导致没有.td属性? :/ –
是的,如果没有'td'元素,它不会工作。 –