Javascript conflict in Magento 2.1 - javascript

I am using an External javascript in the magento2 Block. That external javascript is calling its own jquery library. And this is conflicting with the Magento jquery.
Now, am getting this errors:
Uncaught TypeError: $.widget is not a function
Uncaught TypeError: Cannot read property 'timepicker' of undefined
Uncaught TypeError: Cannot read property 'initObserversForPopup' of undefined
Please help me Resolving this issue.
I also try to add this external js at the Head section and at the end of body tag.
Regards,

Related

How to debug javascript errors in generated build

We have a angular6 app with analytics tracking.
In Analytics we see thousands of javascript errors, for example:
uncaught typeerror: cannot read property 'detachevent' of null
typeerror: null is not an object (evaluating 'e.detachevent')
unable to get property 'detachevent' of undefined or null reference
uncaught typeerror: cannot read property 'height' of undefined
The most part of them (about 98%) seems to be related to polyfills js file.
How can we fix them? is there some tool we can use or something we can do to understand where is the error?
Thanks

Uncaught TypeError: $(...).accordion is not a function

Hi I am having an error on my Wordpress site and my Accordion menu is not working,
Using: https://wordpress.org/support/plugin/accordions/
Uncaught TypeError: $(…).accordion is not a function.
Could be being caused by jQuery versions, not entirely sure, my site was working fine yesterday and I have backtracked my changes and cannot find anything that was different.
Other errors I am getting are:
jquery-migrate.min.js:2 Uncaught TypeError: Cannot read property ‘migrateMute’ of undefined
selectize.min.js:2 Uncaught TypeError: Cannot read property ‘extend’ of undefined
Thanks
Apologies for this kind of vague question.
I solved the problem. There was a defer added on the script tag for mc-validate.js (a mailchimp script) which was causing all the issues. I have no idea why but all problems went away.
Thanks

TypeError when adding javascript to a Freeboard widget plugin

I'm making a widget plugin to display a graph from a RRD file in Freeboard (https://github.com/Freeboard/freeboard).
However, when I add the javascript for handling RRDs in the plugin, I get an exception: "Uncaught TypeError: undefined is not a function".
If I remove the line "./plugins/thirdparty/freeboard-jsrrd/javascriptrrd-1.1.1/src/lib/javascriptrrd.wlibs.js" in the external_scripts array in the file jsrrd.plugin.js, there is no exception.
What can I do to fix this?
Source: https://bitbucket.org/niclask/freeboard-jsrrd/src
Plugin file: plugins/thirdparty/freeboard-jsrrd/jsrrd.plugin.js
Thanks!
The problem was missing javascripts in external_scripts. Once I added the javascripts the graph works.

Why am I getting the error: "Uncaught TypeError: Object #<Object> has no method 'corner'

In the console in chrome, I am getting the error:
Uncaught TypeError: Object # has no method 'corner'
I am using Drupal 6 and my code looks like this:
drupal_add_js('misc/jquery.corner.js');
drupal_add_js("$('.rc-container').corner('4px');$('.dd').corner('tl 0px').corner('4px');$('.n-menu-item').corner('tl 4px').corner('tr 4px');",'inline');
Writing js-code inline like that is bad practice. You should write that in seperate js-files.
Drupal also has a good templating mechanism.
Concerning your question: you should check browser console. There might be an 404 error, showing, that jquery.corner.js is not found. In that case you should rewise path to js-file.

Uncaught TypeError: Cannot call method 'split' of undefined infinte carousel

I implemented an infinite carousel on my site and I get the following error messages:
Resource interpreted as Other but transferred with MIME type undefined.
Uncaught TypeError: Cannot call method 'split' of undefined [line 58]
This is the site: http://www.dwmu.co.uk/test.
How can I resolve this?
It looks like the plugin passes in all the elements in your container, and you have <br> elements between your images. Try just getting rid of those.
edit — looking at the plugin source that definitely seems to be the case.

Categories

Resources