Answer the question
In order to leave comments, you need to log in
How to check for cookies and perform a specific action?
I have a code:
When entering the site, click appears, after clicking it, click is hidden and main appears
#main {
display: none;
}
function FuncImages() {
document.getElementById("main").style.display = "block";
document.getElementById("click").style.display = "none";
}
<div id = "main">Данные</div>
<div id = "click" onclick = "FuncImages()">Здесь картинка</div>
document.cookie="click=yes;
Answer the question
In order to leave comments, you need to log in
PHP
if (isset($_COOKIE["name_of_cookie"])) {
// то выполняем действия необходимые
}
To work with cookies, I personally use the jQuery Cookie Plugin https://github.com/carhartl/jquery-cookie
if($.cookie('click')){
ваш код
}
You can do it like this → JSFiddle
(cookies do not work on jsfiddle, so test it yourself)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question