D
D
Dmitry Kamyannoy2015-11-03 09:32:37
JavaScript
Dmitry Kamyannoy, 2015-11-03 09:32:37

How to store the result of the click() function in cookies?

Good morning wt. guru. I'm trying to use the jquery cookies plugin and using it I'm trying to save changes.
Here's a trite class change for three points.

$('.JPY').click(function() {
       $('.RUB').removeClass('active');
      $('.JPY').addClass('active');
      $('.USD').removeClass('active');
    });

And no matter what I do, even up to this . And it was even wrapped in another function and tried to pass it as an argument to $.cookies Cookies are saved, but the result of the function is not saved ... well, that is, it returns to the reverse. Please tell me how to work with them, since I myself encountered cookies for the first time. Thanks in advance)
$.cookie('JPY', $(' .JPY').addClass('active'));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail, 2015-11-03
Chirskiy @chirskiy_mixail

if ($.cookie('JPY')) {
    $(' .JPY').addClass('active');
}

Something like this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question