Log In

Email:
Password:
Keep me logged in

Forgot Password

Email:




Archives
2013
March (7)
February (13)
January (14)
2012
December (12)
November (12)
October (12)
September (6)
August (12)
July (6)
June (12)
May (6)
April (12)
March (6)
February (12)
January (12)
2011
December (11)
November (14)
October (11)
September (4)
August (16)
July (8)
Categories
CSS (28)
jQuery (116)
PHP (52)
.htaccess (5)
iPod (1)
iPhone (16)
Sponsored Links


Set Cookies in jQuery

Browse Category | Monday, August 15, 2011 |

Description: Set cookies in jQuery with an essential plug-in.







Code:
<html>
<head>
<script src="http://wcetdesigns.com/assets/javascript/jquery.js"></script>
<script src="http://wcetdesigns.com/assets/javascript/jquery/cookie-plugin.js"></script>
<script>
function cook(){
var e = $("#e").val();
var p = $("#p").val();
$.cookie("email", e, { expires: 3650 }); IN DAYS
$.cookie("password", p, { expires: 3650 }); IN DAYS
function loadcooks(){
var ec = $.cookie("email");
var pc = $.cookie("password");
$("#e").val(ec);
$("#p").val(pc);
}
</script>
<head>
<body onLoad="loadcooks()">
<input id="e">
<input id="p">
<input id="l" onClick="cook()" type="button" value="Cook">
</body>
</html>
 1    0
Views: 1,043 Downloads: 8




(Optional in case you want a reply)



0 Comments