I am setting a cookie to launch a modal on page load. Currently, the modal only happens once.
I need it to reset every month, so that it keeps popping up once a month for every visitor.
Is it possible to modify my code to make this happen or do I need to do it another way? Any help appreciated.
$(document).ready(function () {
//if cookie hasn't been set...
if (document.cookie.indexOf("ModalShown=true")<0) {
$("#newsletterModal").modal("show");
//Modal has been shown, now set a cookie so it never comes back
$("#newsletterModalClose").click(function () {
$("#newsletterModal").modal("hide");
});
document.cookie = "ModalShown=true; expires=Fri, 31 Dec 9999 23:59:59 GMT; path=/";
}
});