带cookie的jQuery选项卡-是否存在cookie?

带cookie的jQuery选项卡-是否存在cookie?,jquery,cookies,jquery-ui-tabs,jquery-tabs,jquery-cookie,Jquery,Cookies,Jquery Ui Tabs,Jquery Tabs,Jquery Cookie,我有以下代码: jQuery(document).ready(function($) { $( "#tabs" ).tabs({ collapsible: true, fx: { height: 'toggle', duration: 'fast'}, cookie: { expires: 30 } }); }); 我将jQuery选项卡与cookie集一起使用。如果没有设置cook

我有以下代码:

jQuery(document).ready(function($) {
        $( "#tabs" ).tabs({
            collapsible: true,
            fx: { height: 'toggle', duration: 'fast'},
            cookie: { expires: 30 }
        });
    });
我将jQuery选项卡与cookie集一起使用。如果没有设置cookie,我想隐藏选项卡。我安装了jquery.cookie插件,这是必需的

我的问题


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

能否使用cookie.js中的getter方法执行此操作:

* Get the value of a cookie with the given key.
*
* @example $.cookie('the_cookie');
* @desc Get the value of a cookie.
*
* @param String key The key of the cookie.
* @return The value of the cookie.
* @type String 
差不多

var cookieVal = $.cookie('ui-tabs-1');

你应该使用set和get

//getter
var 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);

我也这么想。但它是选项的Setter/Getter,而不是cookie:)