So I have this function to close a message alert (pop-up model). That works as it should. very simple jQuery. However, I’m trying to add a cookie that when a user closes the pop-up model, if they visit the page again within the same session, the model won’t pop-up again. I want the cookie to expire or delete after browser close. Can’t get it to work though…What am I doing wrong?
I’m using this script:
https://github.com/carhartl/jquery-cookie
// Update Prompt: Hide on 'X' click
function setsomecookie(){ // adds cookie 1 day
$.cookie('message_prompt', 'prompt_closed');
}
$('.updateCloseBTN').click(function () {
$('.upgradeWrap').fadeOut(400, setsomecookie);
});
I would start with the ‘#message_alert_box’ set to {display:none;} in your .css
Then, when the user goes from page to page, you need to verify if the cookie has a specific value