$ .cookie不是一个功能 [英] $.cookie is not a function

查看:138
本文介绍了$ .cookie不是一个功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试加载使用jquery的页面时,当点击以下行时:

When I try to load my page that uses jquery, when the following line is hit:

if ($.cookie('compare') != null) 

我收到错误$ .cookie不是函数。有没有人见过这个?

I get the error $.cookie is not a function. Has anybody seen this before?

推荐答案

这意味着 $ .cookie 插件,至少不会被调用。确保它们都被包含在内,并且在之前被包含在内。在jQuery本身之后包含它是安全的。

That means that the $.cookie plugin isn't being included in the page, at least not being it's getting called. Make sure it's both being included, and is being included before it's getting used. Include it just after jQuery itself to be safe.

只是一个提示:几个其他插件依赖于cookie插件(但不一定在调用之前检查它是否存在),你可以使用一个。

Just a tip: Several other plugins rely on the cookie plugin (but don't necessarily check if it exists before calling it), you could be using one.

这篇关于$ .cookie不是一个功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆