开发者社区 问答 正文

jquery cookie报错:has no method 'cookie'

$(document).ready(function () {
    var a = $.cookie("myAddress");
}
报如下错误:
Uncaught TypeError: Object function ( selector, context ) {
// The jQuery object is actually just the init constructor 'enhanced'
return new jQuery.fn.init( selector, context, rootjQuery );
    } has no method 'cookie'
 
而如果这样写是可以:
var a = $.cookie("myAddress"); 
$(document).ready(function () {
    ...
}
jquery.cookie插件先已经引入了,为什么放在read()里面就不行了呢

展开
收起
a123456678 2016-07-07 10:22:33 2250 分享 版权
1 条回答
写回答
取消 提交回答
  • $(document).ready(function(){});
    
    
    2019-07-17 19:52:34
    赞同 展开评论