Message Boards

Uncaught TypeError: Cannot read property 'apply' of undefined error

thumbnail
Aravinth Kumar, modified 3 Years ago.

Uncaught TypeError: Cannot read property 'apply' of undefined error

Regular Member Posts: 152 Join Date: 6/26/13 Recent Posts

Hi Team,

We are using Liferay DXP 7.2 and we get the below error. Its not blocking any functionality but it shows error in browser console. Did anyone face such issue. Could you please guide us. Thanks in Advance.

/combo?browserId=other&minifierType=js&languageId=fr_FR&b=7302&t=1603795468884&/o/frontend-js-aui-web/aui/aui/aui.js&/o/frontend-js-aui-web/liferay/modules.js&/o/frontend-js-aui-web/liferay/browser_selectors.js&/o/frontend-js-aui-web/liferay/aui_sandbox.js&/o/frontend-js-aui-web/aui/attribute-base/attribute-base.js&/o/frontend-js-aui-web/aui/attribute-complex/attribute-complex.js&/o/frontend-js-aui-web/aui/attribute-core/attribute-core.js&/o/frontend-js-aui-web/aui/attribute-observable/attribute-observable.js&/o/frontend-js-aui-web/aui/attribute-extras/attribute-extras.js&/o/frontend-js-aui-web/aui/event-custom-base/event-custom-base.js&/o/frontend-js-aui-web/aui/event-custom-complex/event-custom-complex.js&/o/frontend-js-aui-web/aui/oop/oop.js&/o/frontend-js-aui-web/aui/aui-base-lang/aui-base-lang.js&/o/frontend-js-aui-web/liferay/dependency.js&/o/frontend-js-aui-web/liferay/util.js&/o/frontend-js-aui-web/aui/aui-base-html5-shiv/aui-base-html5-shiv.js&/o/frontend-js-aui-web/aui/arraylist-add/arraylist-add.js&/o/frontend-js-aui-web/aui/arraylist-filter/arraylist-filter.js&/o/frontend-js-aui-web/aui/arraylist/arraylist.js&/o/frontend-js-aui-web/aui/array-extras/array-extras.js&/o/frontend-js-aui-web/aui/array-invoke/array-invoke.js&/o/frontend-js-aui-web/aui/base-base/base-base.js&/o/frontend-js-aui-web/aui/base-pluginhost/base-pluginhost.js&/o/frontend-js-aui-web/aui/classnamemanager/classnamemanager.js&/o/frontend-js-aui-web/aui/datatype-xml-format/datatype-xml-format.js&/o/frontend-js-aui-web/aui/datatype-xml-parse/datatype-xml-parse.js&/o/frontend-js-aui-web/aui/dom-base/dom-base.js&/o/frontend-js-aui-web/aui/dom-core/dom-core.js&/o/frontend-js-aui-web/aui/dom-screen/dom-screen.js&/o/frontend-js-aui-web/aui/dom-style/dom-style.js&/o/frontend-js-aui-web/aui/event-base/event-base.js&/o/frontend-js-aui-web/aui/event-delegate/event-delegate.js&/o/frontend-js-aui-web/aui/event-focus/event-focus.js&/o/frontend-js-aui-web/aui/event-hover/event-hover.js

thumbnail
Olaf Kock, modified 3 Years ago.

RE: Uncaught TypeError: Cannot read property 'apply' of undefined error

Liferay Legend Posts: 6403 Join Date: 9/23/08 Recent Posts

I don't get that message. It might help if you give a few more steps to reproduce: In which situations do you observe it? Which version (fixpack)? What do you need to have on a page?

thumbnail
Aravinth Kumar, modified 3 Years ago.

RE: Uncaught TypeError: Cannot read property 'apply' of undefined error

Regular Member Posts: 152 Join Date: 6/26/13 Recent Posts

Hi Olaf,

Thanks for your response. Its resolved now.

The issue was with our custom theme and found that there was some jquery conflicts in our theme which was causing issue. 

 

Regards,

Aravinth

 

 

 

 

hlipper john, modified 2 Years ago.

RE: Uncaught TypeError: Cannot read property 'apply' of undefined error

New Member Post: 1 Join Date: 3/14/22 Recent Posts

In JavaScript almost everything is an object, null and undefined are exceptions. This error  occurs when a property is read or a function is called on an undefined variable. Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong to objects. Since undefined is not an object type, calling a function or a property on such a variable causes the TypeError: Cannot read property of undefined.  

If you are not sure a variable that will always have some value, the best practice is to check the value of variables for null or undefined before using them. To avoid getting these types of errors, you need to make sure that the variables you are trying to read do have the correct value. This can be done in various ways. You can do if checks before dealing with objects whose values are bound to change:

if (myVar !== undefined) {
    ...
}

Or

if (typeof(myVar) !== 'undefined') {
    ...
}