How can I set a cookie when a background color is changed? I created a basic switcher which changes the body color, but I want to save the changed color in a cookie.
Any Idea?
jQuery code:
$('.first li').click(function(){
var src = $(this).find('img').attr('src');
$('body').css('background','url('+src+')');
});
Please add the following plugin to your page: https://github.com/carhartl/jquery-cookie
Now you can do the following:
Create cookie:
Read cookie: