Reputation:
So I have this code down below and I now I want to implement it with jquery cookie to fire this code only once in a month, how can I accomplish this?
$(function() {
var $follow = $(".follow-1");
if (!$follow.hasClass("active")) {
$follow.click();
}
});
Upvotes: 1
Views: 47
Reputation: 178403
You likely mean something like this:
$(function() {
var cook = $.cookie("seen"); // get the cookie
if (!cook) { // if no cookie show
var $follow = $(".follow-1");
if (!$follow.hasClass("active")) {
$follow.click();
}
$.cookie("seen","yes",{"expires":30}); // set cookie to expire in 30 days
}
});
Upvotes: 1