Answer the question
In order to leave comments, you need to log in
How to set a cookie when a link is clicked (jQuery)?
There is a link, when you click on it, the style of the block changes (a class is added).
Accordingly, it should work on the entire site until the browser is closed.
How to remember this action in a cookie?
$(".special__link--imgoff").click(function(e){
$("*:not(.sp_ignored) img").addClass('imgoff');
e.preventDefault();
});
Answer the question
In order to leave comments, you need to log in
And why pull the cookie and then drag it back and forth. I would do this:
$(".special__link--imgoff").click(function(e){
$("*:not(.sp_ignored) img").addClass('imgoff');
localStorage.setItem("class", "imgoff");
e.preventDefault();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question