jquery 创建 cookie 失败

js代码:

 $(function(){
        $("#sub").click(function(){
             alert($("#uname").val()+'  '+$("#upwd").val());
             $.cookie("uname",$("#uname").val(),{expires:7});
             $.cookie("upwd",$("#upwd").val(),{expires:7});
             alert('cookie saved');
    });
});

页面:

<script type="text/javascript" src="jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="jquery/jquery.cookies.2.2.0.min.js"></script>


 用户名:<input type="text" id="uname"/><br>
            密&nbsp;&nbsp;码:<input type="password" id="upwd"/><br>
            <input type="button" id="sub" value="提交" style="margin-left:163px; "/>

能正确弹出uname和upwd值 cookie saved没有弹出
是代码问题 还是我导入的cookie插件问题?

没有正确导入jquery.cookie插件。。毛事jquery.cookie最高版本是1.4吧,你的2.2了?另外一个版本的jquery.cookie.js?

下载这个:https://github.com/carhartl/jquery-cookie

你的页面是运行在哪,是不是js没有权限等。查看一下浏览器chrome等的console看是否有错误输出