Uncaught TypeError: Cannot read property 'length' of undefined

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33210743/article/details/79929225

Uncaught TypeError: Cannot read property ‘length’ of undefined

1,问题原因:是$.each()函数执行报的错,在执行each时,传入的参数为undefined
或为null时也会有此错误’length’ of null
2,解决方案:在each前先判断是否为undefined或者是否为空,如是则不遍历就不会js报错了。

猜你喜欢

转载自blog.csdn.net/qq_33210743/article/details/79929225