Search code examples
jqueryjquery-cookie

JQuery Cookie loads but returns error always


I just get:

8:21 Uncaught TypeError: Cannot read property 'set' of undefined

for:

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryval")
<script src="~/Scripts/jquery.cookie.js"></script>
<script>
    $.cookies.set('TEST', "VALUEEEE", { path: '/' }); // <-- errs here
</script>

I'm in MVC5, tried this directly on a page, in layout, in partial.... no go anywhere... simply get this error no matter what. File is in place from NuGet package and referenced as you see here... Confirmed jQuery loaded, and jquery cookie file loaded...

Screenshot

Cannot get this to work... any ideas?


Solution

  • The docs for the library indicate usage to be like this:

    $.cookie('name', 'value');
    

    There is no .set(...) function