if (getCookie($(this).attr("id")) == true) {
The above code will NEVER evaluate as true because cookie values are stored as strings. You are trying to store a boolean value, which is converted to a string when it is written to the cookie. When the browser reads the cookie value, it is also read as a string.
The fixed version of your code should be:
$('.ss-show-collapse').click(function(){
var collapse_anchor="."+$(this).attr("id")+' span';
show_collapse=".ss-show"+$(this).attr("id").replace('ss-show-collapse', '');
$(show_collapse ).toggleFade('slow');
$(collapse_anchor).toggle();
if (getCookie($(this).attr("id")) == 'true') {
setCookie($(this).attr("id"), 'false', 1);
} else {
setCookie($(this).attr("id"), 'true', 1);
}
return false;
});
I would also suggest looking into using event.preventDefault();
instead of return false;
http://fuelyourcoding.com/jquery-events-stop-misusing-return-false/
$('.ss-show-collapse').click(function(event){
var collapse_anchor="."+$(this).attr("id")+' span';
show_collapse=".ss-show"+$(this).attr("id").replace('ss-show-collapse', '');
$(show_collapse ).toggleFade('slow');
$(collapse_anchor).toggle();
if (getCookie($(this).attr("id")) == 'true') {
setCookie($(this).attr("id"), 'false', 1);
} else {
setCookie($(this).attr("id"), 'true', 1);
}
event.preventDefault();
});