testing cookie plugin - jquery
HTML
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<a id="dnn_dnnLOGIN_cmdLogin" href="Login">
Login
</a>
||
<a id="dnn_dnnLOGIN_cmdLogin" href="Logoff">
Logoff
</a>
<br />
<a id="see" href="#">
see
</a>
JavaScript
$('#dnn_dnnLOGIN_cmdLogin').live('click', function() {
var preval = $.cookie('DNN-COOKIE');
if(preval != null) {
$(this).hide();
} else {
var action = $(this).attr('href');
var cookie_value = (action == 'Login') ? 1 : null;
$.cookie('DNN-COOKIE', cookie_value);
}
return false;
});
// clicking on 'see' should bring up an alert box display the cookie value of 1 or 0
$('#see').live('click', function() {
alert($.cookie('DNN-COOKIE'));
return false;
});