【异常】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
推荐阅读
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object
-
npm ERR! Cannot read property 'path' of null
-
js报错 Cannot read property 'getAttribute' of null
-
微信小程序报Cannot read property 'setData' of undefined的错误
-
webpack报错Cannot read property 'presetToOptions' of undefined
-
Extjs4---Uncaught TypeError: Cannot read property ‘items’ of undefined
-
JavaScript Uncaught TypeError: Cannot read property 'value' of null
-
Cannot read property 'tap' of undefined
-
Vue报错:Uncaught TypeError: Cannot assign to read only property’exports‘ of object’#
-
Property or field ‘XXX‘ cannot be found on null