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

Was it helpful?

Solution 2

I initially loaded jquery.cookie in the <head> of my site. Moving it to the very bottom fixed it.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top