1

I have been struggling with some jQuery code in order to retrieve the value of a cookie and have it stored as a variable. ie.

var myCookie = $.cookie('myCookie')

This returns an error in console. Someone mentioned that the standard jQuery doesn't work and I have to have some sort of a plugin??

Does anyone know what I need to do in WordPress to get this to work, download from etc so I can call on a value for a cookie? Thanks.

SamualG
  • 35
  • 1
  • 6
  • Yes, you need the [jQuery cookie plugin](https://github.com/carhartl/jquery-cookie). see also: https://stackoverflow.com/questions/1458724/how-do-i-set-unset-a-cookie-with-jquery . do keep in mind that the jQuery cookie plugin is no longer being developed. Try [JSCookie](https://github.com/js-cookie/js-cookie) instead. – Zackary Jones Jul 31 '18 at 16:22

0 Answers0