<script>
$(function() {
/*check username exist in coockie*/
if ($.cookie('username')) {
/*get username*/
var Setusername = $.parseJSON($.cookie("username"));
/* set username into div*/
$("#login-email").val(Setusername);
/* alert("Setusername true");*/
}
/*check password exist in coockie*/
if ($.cookie('password')) {
/*get password*/
var Setpassword = $.parseJSON($.cookie("password"));
/* set password into div*/
$("#login-password").val(Setpassword);
}
/*Submit Button Click*/
$('.login-register-login-submit').mouseover(function() {
/* if checkbox is checked*/
if ($("#RememberMe").prop('checked') == true) {
/*username*/
var username = $('#login-email').val();
/* console.log("username", username);*/
/*if username is alaready set in cookie*/
if ($.cookie('username')) {
/*remove username*/
$.removeCookie('username');
}
/* set current username*/
$.cookie("username", JSON.stringify(username), { expires: 14 });
var CoockieUsername = $.parseJSON($.cookie("username"));
/* password*/
var password = $('#login-password').val();
/*if password is alaready set in cookie*/
if ($.cookie('password')) {
/*remove password*/
$.removeCookie('password');
}
/* set current password*/
$.cookie("password", JSON.stringify(password), { expires: 14 });
var CoockiePassword = $.parseJSON($.cookie("password"));
/* if checkbox is not checked*/
} else {
/* if username is set in cookie*/
if ($.cookie('username')) {
/*remove username*/
$.removeCookie('username');
}
/* if password is set in cookie*/
if ($.cookie('password')) {
/*remove password*/
$.removeCookie('password');
}
}
});
});
</script>