I would like to assign a cookie to a variable...
e.g.
var aVariable = $.cookie("moo");
I am using the jQuery cookie functions - do I need to set the cookie AND set the variable at the same time or something?
Help pretty please!
^.^
My Code:
function goBackToPosition() {
var xPos = $.cookie("yourPositionX");
var yPos = $.cookie("yourPositionY");
console.log(xPos);
console.log(yPos);
if (xPos) {
alert("xpos!");
$(this).animate({
top: yPos,
left: xPos
}, 400, function(){
$.cookie("yourPositionX", null);
$.cookie("yourPositionY", null);
});
}
}
I get the following error: a.ownerDocument is undefined