带cookie的jQuery选项卡 – 如果cookie存在?

带cookie的jQuery选项卡 – 如果cookie存在?,第1张

概述我有这个代码: jQuery(document).ready(function($) { $( "#tabs" ).tabs({ collapsible: true, fx: { height: 'toggle', duration: 'fast'}, cookie: { expires: 30 } 我有这个代码:

jquery(document).ready(function($) {        $( "#tabs" ).tabs({            collapsible: true,fx: { height: 'toggle',duration: 'fast'},cookie: { expires: 30 }        });    });

我使用带有cookie集的jquery选项卡.如果没有设置cookie,我想隐藏选项卡.我安装了jquery.cookie插件是必需的.

我的问题

如何检查选项卡cookie是否已设置?

解决方法 你应该使用set和get

//gettervar cookie = $( ".selector" ).tabs( "option","cookie" );//setter$( ".selector" ).tabs( "option","cookie",{ expires: 30 } );

编辑

设置cookie的名称并使用getter和setter

$("#selector").tabs({        cookie: {            name: 'mycookie',expires: 10        }    });        Get the cookie         alert($.cookie('mycookie'));        Set the cookie         $.cookie('mycookie',null);
总结

以上是内存溢出为你收集整理的带cookie的jQuery选项卡 – 如果cookie存在?全部内容,希望文章能够帮你解决带cookie的jQuery选项卡 – 如果cookie存在?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1077094.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存