开发者

how to append the cookies values

开发者 https://www.devze.com 2023-04-09 03:06 出处:网络
I have four cookie values like $.cookie(\'line1side1\',{ path:\'/\'}) and $.cookie(\'line2side1\',{ path:\'/\'})

I have four cookie values like $.cookie('line1side1',{ path:'/'}) and $.cookie('line2side1',{ path:'/'})

I want to append this all values and assign it to the one text-box.

document.getElementsByName('Custom_Field_Custom7')[0].value= all values of 开发者_如何学Ccookie

How should I write?


This uses jQuery (I'm assuming you're using it since you reference $.cookie). Basically you can grab the current cookie collection, split it into the cookies and map the values into an array. Then just join the array and dump it into your textbox.

alert($.map(document.cookie.split(";"), function(c){ return c.split("=")[0];  }).join(", "));
0

精彩评论

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

关注公众号