我想这将是我得到的一个非常明显的答案,但我自己真的找不到。
这是我的表格(我省去了所有的 tds)
<table id="COA_Table">
<thead>
<tr>some th</tr>
</thead>
<tbody>
<tr>some TD</tr>
</tbody>
</table>
这是我的 jQuery 代码:
$(document).ready(function () {
console.log("ready!");
$('#COA_Table > tbody:last').append('<tr><td><input type=\"checkbox\"></td><td></td>New account<td></td><td></td></tr>');
})
最后,我得到的错误代码:
Uncaught TypeError: Cannot read property 'childNodes' of null
这让我发疯
最佳答案
请注意,您的结构中有错误
<td></td>New account<td></td>
此文本未放置在任何地方,可能会导致完整代码中出现错误。
应该是这样
<td></td><td>New account</td>
关于jquery - append 到表时无法读取 null 的属性 'childNodes',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17305240/