Uncaught TypeError: Cannot read property ‘cookie’


So, I’ve got a page where i set a cookie with js-cookie script and following code. js.cookie-2.1 is loaded right before that script.

 Cookies.set('dir', '1');

No JS errors there. When i try to get the cookie value on a different page, it looks like cookie script is not loading. Using following code

    var cookie = $.cookie('dir');
       if (cookie > 1) { 
          } else { 

And i’m getting this error “Uncaught TypeError: Cannot read property ‘cookie’ of undefined”. js-cookie script is also loaded right before the above code.

Link: Uncaught TypeError: Cannot read property ‘cookie’
Source: Stack Jquery


About Author

Leave A Reply