Answer the question
In order to leave comments, you need to log in
Is it possible to add styles to cookies?
Let's say there are two blocks
(style="display:none")Block 1
(style="display:block")Block 2
I want to make sure that styles are written to the cookie on click, but vice versa. That is, so that after clicking, the styles change:
(style="display:block")Block 1
(style="display:none")Block 2
Accordingly, after clearing the cookie, everything fell into place.
So, is it really possible to do this through cookies? Or, better through the session?
Answer the question
In order to leave comments, you need to log in
> Is it possible to add styles to cookies?
Maybe why not. More precisely, add a sign that the button was pressed. And depending on it, hang styles.
> Or, it is better through session?
So session also uses cookies for storage of all parameters.
Do it in LocalStorage. As for me, sessions and cookies are suitable for identification, rather than storing something left there. And LocalStorage is just right for this. Here the choice is yours. (For example, I store such data in LocalStorage)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question