Mon Jan 07, 2013 11:29 pm
$.cookie("CookieName", "Value");
$.cookie("CookieName", "Value", { expires: 1 });
$.cookie("CookieName", "Value", { expires: 1,path : '/' });
$.cookie("CookieName", "Value", { expires: 1,path : '/',domain : 'codemiles.com' });
$.cookie("CookieName", "Value", { expires: 1,path : '/',domain : 'codemiles.com',secure : true });
alert($.cookie("CookieName"));
$.cookie("CookieName", null);
$.removeCookie("test");
<html>
<head>
<title>Create Cookie- Remove Cookie JQuery</title>
<!--
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
Note you can download the JQuery package instead of using Google version. -->
<script src="jquery-1.8.3.js"></script>
<script src="jquery.cookie.js"></script>
<style type="text/css">
body
{
background:#5477BE;
font-size:22px;
}
</style>
<script>
$(document).ready(function(){
$("input#sbtButton").click(function(){
$.cookie("firstCookie", "Yam");
$('div#div1').append("Cookie Created, expires after one day<br/>");
$('div#div1').append("Cookie value="+$.cookie("firstCookie")+"<br/>");
$.cookie("firstCookie", null);
$('div#div1').append("Cookie has been deleted..."+"<br/>");
});
});
</script>
</script>
</head>
<body>
<b>Press on the next button to print and create Cookie :</b><br/>
<input type="button" value="Add Cookie" id="sbtButton" />
<div id="div1"></div>
</body>
</html>
https://github.com/carhartl/jquery-cookie/blob/master/jquery.cookie.js
http://archive.plugins.jquery.com/project/Cookie
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.