Answer the question
In order to leave comments, you need to log in
How to read cookies when re-entering the site?
The question is: using the jquery.cookie plugin, a confirmation window for entering the site was created, but when the page is refreshed, the window appears again. How to read cookies when you re-enter the site? code example:
var years = $.cookie("18old");
if(years != 1) {
$('#popup-wrapper').show();
}
$('.no').click(function(){
window.location.replace("");
});
$('.yes').click(function(){
$('#popup-wrapper').hide();
$.cookie("18old", 1, { expires : 30 });
});
Answer the question
In order to leave comments, you need to log in
Put the code in a tag.
According to the code, everything seems to be correct, which means errors are in the process of execution, respectively, use the console to catch errors, alert / console.log () to view the current state of the variables and check the script. In short, you need to debug, learn to use the brain debugging tools.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question