js-cookie值未定义 [英] js-cookie value is undefined

查看:353
本文介绍了js-cookie值未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从cookie名称"中获取字符串"value",但是,"undefined"总是打印出来. 我正在使用chrome,如有任何帮助,我们将不胜感激

I am trying to get the string "value" from the cookie "name" however, 'undefined' is always printing out. I am using chrome and any help would be appreciated

这是我的代码:

Cookies.set('name', 'value');
var plswork = Cookies.get('name');
document.write(plswork);

推荐答案

  • Cookie存储在"document.cookie" JavaScript对象中

    • Cookies are stored in the "document.cookie" JavaScript object

      var a = document.cookie; document.write();

      var a = document.cookie; document.write();

      这篇关于js-cookie值未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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