0
votes

I included the newest jQuery installation in my Magento theme, but then prototype.js was throwing an error because two jQuery files were being loaded I guess. I removed it and the prototype errors stopped popping up, however bootstrap is now throwing me an error:

Uncaught TypeError: undefined is not a function

And many people are saying it's because jQuery is not being loaded. So then I load jQuery back in and then prototype throws these errors again (repeatedly):

Uncaught TypeError: Object [object Object] has no method 'attachEvent' prototype.js:5653

Uncaught TypeError: Object [object Object] has no method 'dispatchEvent' prototype.js:5734

So.. I'm getting confused on how to solve this exactly.. When I delete my jQuery.js file, those errors stop and then bootstrap throws an error.. but no other jQuery installation is being loaded from what I can see so that only makes sense bootstrap would throw an error. So then I just can't see why these errors are being thrown for prototype when most people say it's because two jQuery instances are being loaded.

2
Is bootstrap.js using $? If it's not already wrapped in (function($) { //code here })(jQuery), bootstrap might be trying to call jQuery functions on prototype.js objects. - giaour
It starts off like this : !function(e){"use strict";e(function(){ and ends something like this : })}(window.jQuery); I'm using almost the latest installation from like last week. - Peanut

2 Answers

1
votes

Bootstrap is known to not play nicely with Prototype.js. Try using the bootstrap-prototype fork.

1
votes

Ok FINALLY after a week of doing this since the other comment didn't make my problems go away.. this is seriously all I had to do:

I put this in a jquery-noconflict.js file : jQuery.noConflict(); And added it in right after my jQuery.js file and everything is working fancy! =) And all these errors that I couldn't make go away for the past week disappeared as well =)