Set Cookie in JS with expire date

let setCookie = (cookieName, cookieValue, days) => { var today = new Date(); var expire = new Date(); expire.setTime(today.getTime() + 3600000*24*days); document.cookie = cookieName+"="+encodeURI(cookieValue) + ";expires="+expire.toGMTString(); } setCookie('clickCross', '', 1); setcookie('clickDownload', '', 7);

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.