I’m trying to read an array from a cookie like this:
var arr = $.makeArray($.cookie("mycookie"));
jQuery.each(arr, function() {
$('#' + this).removeClass('collapsed');
});
The problem is it works only with the first item from the array. Can you help?
$.makeArraydoesn’t magically turn strings into arrays. It’s for converting array-like objects into proper JavaScript arrays. Example:…which is probably not what you’re looking for.
Your question does not include what the value of
$.cookie("mycookie")is, but assuming it’s something like'a b c d', you can just useString.split():