Reputation: 375
First of all I want to say that i've searched across the internet and could not find my answer anywhere.
I've tried to use jquery-coockie.js into my wordpress template, where i've created my own page for some kind of calculator.
When i'm trying to excecute my
if ($.cookie('cart')){
it gives me the error :
uncaught typeerror: cannot read property cookie of undefined
I've included my jquery-cookie.js correctly, so not-including is not giving me the problem.
Upvotes: 0
Views: 7945
Reputation: 406
Seems that jQuery is in noconflict mode. Try this code:
jQuery.cookie('cart')
Upvotes: 2
Reputation: 2330
The error you've pasted indicates that JQuery is not defined. Did you include that earlier in the page?
In other locations on the page, you refer to JQuery by calling jQuery(...)
, so it seems that you do have it, but it's stored as a different variable.
If you're controlling the line that fails (if it's not a part of that external Cookie script), use jQuery.cookie(...)
instead.
If you don't control the script adding JQuery to the page, you could instead alias it to $ yourself -- $ = jQuery;
Upvotes: 0