我正在使用这个插件来存储一些cookie:
https://code.google.com/p/cookies/wiki/Documentation
我想知道如何删除所有带有某个前缀的cookie和/或删除所有具有某个值的cookie。我需要这样做,一旦一些用户已经通过我的应用程序完成了他们的旅程。
例如,我将某些表的可见状态存储在页面上,如下所示:
// check visible status of table and persist
$('div.dependant').each(function(){
var $childCount = $(this).index('div.dependant');
$(this).addClass('tableStatus' + $childCount);
// get the value of the cookie
var $tableStatus = $.cookies.get('tableStatus' + $childCount);
// if variable not null
if ($tableStatus) {
if ($tableStatus == 'hidden') {
$('.tableStatus' + $childCount).hide();
} else if ($tableStatus == 'visible') {
$('.tableStatus' + $childCount).show();
}
}
});因此cookies将是'tableStatus0','tableStatus1‘等...
我可以手动删除,但将有未知数量的表。
发布于 2010-07-14 20:44:15
https://stackoverflow.com/questions/2407866
复制相似问题