How to Retrieve Cookie Value using Jquery JS Cookie

Viewed 9556

I am using a jQuery cookie plugin called JS Cookie and what happens is that I am unable to retrieve the data or the value in the cookie. I would like to store the value of the cookie that was inputted on the text box and retrieve it in the text field when the page is visited again.

$(document).ready(function() {
    var cookie_email = Cookies.get('user_email');
    $('#email_address').val(cookie_email);

    $('#test_button').click(function() {
        Cookies.set('user_email', email_address, {
            expires: 365
        });
    });
});

https://jsfiddle.net/mue1amcm/

1 Answers
Related