Setting up Cookies with jquery with a w3schools example
<p>p>I am trying to set up a cookie with jquery, I am using the example from w3schools as shown below. When running this example on the w3schools website it works fine, when trying to run it from my own computer (iMac) it does not work, any reason why?</p></p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*1000));
    var expires = "expires="+d.toUTCString();
    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}

function getCookie(cname) {
    var name = cname + "=";
    var ca = document.cookie.split(';');
    for(var i = 0; i &lt; ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
        }
        if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
        }
    }
    return "";
}

function checkCookie() {
    var user = getCookie("username");
    if (user != "") {
        alert("Welcome again " + user);
    } else {
        user = prompt("Please enter your name:", "");
        if (user != "" &amp;&amp; user != null) {
            setCookie("username", user, 365);
        }
    }
}
setCookie('name', 'value', 1);
checkCookie();</code></pre>
</div>
</div>
</p>