Cannot read property 'defaultView' of undefined js操作异常

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Cannot read property 'defaultView' of undefined js操作异常相关的知识,希望对你有一定的参考价值。

在function(obj){}函数中操作对象时,突然遇到“Cannot read property ‘defaultView‘ of undefined”js报错!

打印出obj即可发现问题,在js函数传参时$(this)传递的是父类的jquary对象,this传递的是父类html对象。当this包含在B函数对象中调用时,需要在调用B之前把this复制一份var thisObj=this。

以上是关于Cannot read property 'defaultView' of undefined js操作异常的主要内容,如果未能解决你的问题,请参考以下文章

Uncaught TypeError: Cannot read property 'addEventListener'

Uncaught TypeError: Cannot read properties of undefined (reading 'getUserMedia')

axios报错: Cannot read property 'protocol' of undefined ....

解决报错Cannot read property 'forceUpdate' of undefined

VUE TypeError: Cannot read property 'validate' of undefined

Cannot read property 'map' of undefined