Javascript 如何设置关闭按钮的cookie

Javascript 如何设置关闭按钮的cookie,javascript,jquery,cookies,Javascript,Jquery,Cookies,我想在按下关闭按钮时设置cookie,以防止对话框再次打开 这是我的代码: <div class="card"> <span class="clickable" data-effect="fadeOut"><i class="fa fa-times"></i></span> <div class="card-blockquote">Free shipping </div> </div>

我想在按下关闭按钮时设置cookie,以防止对话框再次打开

这是我的代码:

<div class="card">
  <span class="clickable" data-effect="fadeOut"><i class="fa fa-times"></i></span>
    <div class="card-blockquote">Free shipping </div>
</div>

<script>
jQuery('.close-icon').on('click',function() {
  jQuery(this).closest('.card').fadeOut();
})
</script>
在控制台中,我有:

TypeError: $.cookie is not a function

您可以使用cookie生成器


jQuery('.close图标')。在('click',function()上{
jQuery(this).closest('.card').fadeOut();
$.jCookies({
姓名:'你的小甜饼',
值:{cookie值}
});
})

因此,如果您想使用本地存储,您可以使用

谢谢,但我更喜欢使用本地存储或jquerycookies@StefanD. 使用如何将cookie设置为1天,例如我的代码?事实上,名字是什么:'你的cookie'u Namee',值是:{cookie values}
 $.cookie('card', 'card', { expires: 7 });
TypeError: $.cookie is not a function
<script>
jQuery('.close-icon').on('click',function() {
  jQuery(this).closest('.card').fadeOut();
$.jCookies({
    name : 'Your_cookie_Namee',
    value : {cookie values}
});

})
</script>