S
S
Secret732017-10-04 16:46:50
JavaScript
Secret73, 2017-10-04 16:46:50

Why doesn't the jquery cookie code work?

Tell me why this code does not work? Even if there is a cookie, the class is not deleted

if (!$.cookie('cookie_name')) {
      $('#msg').addClass('blackZone');
        $.cookie('cookie_name', 'cookie_value', {
      		expires: 5,
      		path: '/',
      });
    } else {
      $('#msg').removeClass('blackZone');
    }


Here is the whole code jsfiddle.net/1Lpdykhx/55

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question