Add jQuery Cookies

$(document).ready(function () { $("#delCookie").click(function(){ del_cookie("cookie"); }); console.log(document.cookie); var visit = getCookie("cookie"); if (visit == null) { alert("Your Message Goes here and you only get to see it once!"); var expire = new Date(); expire = new Date(expire.getTime() + 7776000000); document.cookie = "cookie=here; expires=" + expire; } }); function del_cookie(name) { document.cookie = name + '=; expires=Thu, 01 Jan 1970 00:00:01 GMT;'; } function getCookie(c_name) { var c_value = document.cookie; var c_start = c_value.indexOf(" " + c_name + "="); if (c_start == -1) { c_start = c_value.indexOf(c_name + "="); } if (c_start == -1) { c_value = null; } else { c_start = c_value.indexOf("=", c_start) + 1; var c_end = c_value.indexOf(";", c_start); if (c_end == -1) { c_end = c_value.length; } c_value = unescape(c_value.substring(c_start, c_end)); } return c_value; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.