I initially loaded jquery.cookie in the <head>
of my site. Moving it to the very bottom fixed it.
Issue with $.noConflict, jquery.cookie, and bootstrap
-
09-10-2022 - |
Question
I am trying to use jquery.cookie to handle all of my cookie needs. Whenever I try to create a cookie, I get the following error:
Uncaught TypeError: Object function (e,t){return new x.fn.init(e,t,r)} has no method 'cookie'
I read to use $.noConflict()
to fix this issue, which did indeed resolve the error above. However, when I use it, I get errors thrown about bootstrap's .tooltip()
, as well as $.sidr
which I use for my slide out menu.
Does someone have some suggestions on resolving this?
Thanks
Solution 2
OTHER TIPS
Once you invoke noconflict mode you can no longer reference jQuery with $
I usually do it like this:
$j = jQuery
$j.noConflict();
$j(function(){
$j('yourSelector').tooltip();
});
There is probably a more efficient way than duplicating the jQuery function, suggestions are always welcome