<script src="/path/to/jquery.js"></script><script type="text/javascript" src="/path/to/jquery.cookie.js"></script>$.cookie("UserAge", 43); // this will save 43 in you cookie named UserAge.$.cookie("UserAge"); // will give cookie value = 43.$.removeCookie("UserAge"); // cookie removed.$.cookie("city", "Indore", {path: "/", domain: "abc.com"}); $.cookie("name", "Lap", {expires: new Date(2018, 12, 31, 11, 59, 00) }); // expire on specific dateCreate expiring cookie, 7 days from then:
$.cookie('name', 'value', { expires: 7 });
$.cookie('name', 'value', { expires: 7, path: '/' });
This article showed you how to manage cookies using jquery.cookie, a jQuery plugin. It solves many problems by abstracting cookie implementation details into a few simple, flexible methods. In case you need further clarification or additional examples, please refer to the official documentation. Now other tradition way is,var ck = getCookie("CookieName"); // getsetCookie("CookieName","value",1); // set
Code:
Blog Part 1 (Basics, Selectors and scroll bar)
Blog Part 2 (Get and set values of different elements)
Blog Part 3 (JavaScript windows code and Cookies)
var windowWidth = $(window).width(); //retrieve current window width
var windowHeight = $(window).height(); //retrieve current window height
var documentWidth = $(document).width(); //retrieve current document width
var documentHeight = $(document).height(); //retrieve current document height
var vScrollPosition = $(document).scrollTop(); //retrieve the document scroll Top position
var hScrollPosition = $(document).scrollLeft(); //retrieve the document scroll Left position
Blog Part 2 (Get and set values of different elements)
Blog Part 3 (JavaScript windows code and Cookies)
--
Regards,
Praveen Pandit
No comments:
Post a Comment