testing cookie plugin - jquery
by dirkk0
HTML
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<div id="login">
set cookie
</div>
JavaScript
// $.cookie('the_cookie', null);
a = $.cookie('the_cookie');
$('#login').html($.cookie('the_cookie'));
if (a) {
// $('#login').html($.cookie('the_cookie'));
$('#login').html(a+ ' logged in. <button id');
$('#login').click(function() {
alert('Handler for .click() called.');
$.cookie('the_cookie', null);
});
// $.cookie('the_cookie', 'the_value', { expires: 7 });
// $.cookie('the_cookie', null);
}
else
{
var r = prompt('name');
if (r) {$.cookie('the_cookie', r, { expires: 7 });}
}