问答详情
源自:2-5 cookie插件——cookie

$.cookie(key,value,{path:"/",expires:7})后面{}里的是什么属性

  <script type="text/javascript">
            $(function () {
//          	console.log(111)
                if ($.cookie("email")) {
                    $("#email").val($.cookie('email'));
                }
                $("#btnSet").bind("click", function () {
                    if ($("#chksave").is(":checked")) {
                        $.cookie('email',$('#email').val()
                 	)
                    console.log($.cookie('email'));
                    }
                    else {
                        $.cookie('email',null)
                    }
                });
            });
        </script>


提问者:一家之煮 2017-02-07 09:40

个回答

  • weibo_单色玲珑_0
    2017-02-07 11:19:37

    expires :设置cookie存在周期
    path : 设置cookie作用域,'/'也就是全局了