欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

【异常】Cannot read property ‘innerHTML‘ of null

程序员文章站 2022-06-07 12:35:35
...

Cannot read property ‘innerHTML’ of null

出现这个错误可能的原因:

1、下面代码中,如果我的 this 没有获取到值,就会报这个错;

$(this).parents("tr").children[3].innerHTML;  

2、没有获取到当前 id 的值
(下面代码中,如果 id 输入错误,也会报这个错)

toPrice = document.getElementById("goods_Price").innerHTML; 

3、数据没有加载完就进行获取,获取不到该值。

参考这篇博客:https://blog.csdn.net/mini_1251861209/article/details/81867575

相关标签: 报错异常