Jquery.cookie Implementation Remember password function

Source: Internet
Author: User

Jquery.cookie Implementation Remember password function

$.cookie (' The_cookie '); Read cookies
$.cookie (' The_cookie ', ' the_value '); Store cookies
$.cookie (' The_cookie ', ' The_value ', {expires:7}); Store a cookie with a period of 7 days
$.cookie (' The_cookie ', ', {Expires:-1}); Delete Cookies

//Verify that the password is remembered when the page is initialized
$ (document). Ready (function () {
if ($.cookie ("rmbuser") = = "true") {
$ ("#rmbuser"). att R ("Checked", true);
$ ("#user"). Val ($.cookie ("username"));
$ ("#pass"). Val ($.cookie ("password"));
//Save user Information
Function saveuserinfo () {
if ($ ("#rmbuser"). attr ("checked") = = True) {
var username = $ ("#use R "). Val ();
var password = $ ("#pass"). Val ();
$.cookie ("Rmbuser", "true", {expires:7});//Store a cookie with a 7-day period
$.cookie ("username", username, {expires:7}) ; Store a cookie with a 7-day term
$.cookie ("Password", password, {expires:7});//Store a cookie with a 7-day expiration
else {
$.c Ookie ("Rmbuser", "false", {Expires:-1});
$.cookie ("username", "", {Expires:-1});
$.cookie ("Password", "", {Expires:-1});

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.