Live
Live

Reputation: 79

Doesn't save changes when using a cookie

I have this code for change a text color on page. Switching works good, but the cookie does not save any changes.

Any idea what's wrong?

 $(".white").click(function(){
        $('.welcome h1,.box p, .newsletter, .responsive, .beauti, .unlimited,.flex-active').css("color","#ffffff");
         if( $.cookie('color') != undefined) {
            $('.welcome h1,.box p, .newsletter, .responsive, .beauti, .unlimited,').css('color', 'url(' + $.cookie('color') + ')');}

Thanks!

Upvotes: 0

Views: 95

Answers (2)

Genson
Genson

Reputation: 117

You need to set $.cookie("color", "value"); for saving change.

Upvotes: 2

Karl Johan
Karl Johan

Reputation: 4022

You can't use url(xxx) for colors. It should be HEX, RGB or HSL

Upvotes: 2

Related Questions