Reputation: 2201
I tried inserting a variable in cookie name
jQuery.cookie("box'+ variablename +'","open", {expires: 365});
What am i doing wrong here?
Upvotes: 0
Views: 219
Reputation: 288
the name of cookie you are trying to save will look like this
box'VariableName'
Remove the single parenthesis.
Upvotes: 0
Reputation: 227310
You forgot the a "
before and after the +
.
jQuery.cookie("box'"+ variablename + "'","open", {expires: 365});
//-----------------^-----------------^
Do you really want the '
inside of the string? You probably don't. In that case lose the '
s.
jQuery.cookie("box"+ variablename, "open", {expires: 365});
Upvotes: 4