开发者

How to store dyanamic value into jquery cookie variable

How can we store dyn开发者_如何学JAVAamic variables into cookie .

var username = ($("#username").val());

how to store the variable username into jquery cookie variable

$.cookie('username', '+username +');
alert($.cookie('username'));


If you put within a single quotes it takes only string.So for this you don't need the single quotes for assigning the value.

Try this

$(document).ready(function() {
    var username = ($("#username").val());
    $.cookie('username', username ); 
    alert($.cookie('username'));  
});

It works for me.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜