문제

When the element h4 is clicked, I would like to .toggle() the .mChatBodyFix but I would like to toggle the $.cookie to either be yes or no

    $('.cat h4').not('.mChatOpts span').click(function(){
        $('.mChatBodyFix').toggle();
        $.cookie('chat', 'yes', {expires:1});
    });
도움이 되었습니까?

해결책

How about

$.cookie('chat', $.cookie('chat')=='yes'?"no":"yes", {expires:1});

다른 팁

Try this!

$('.cat h4').not('.mChatOpts span').click(function(){
    $('.mChatBodyFix').toggle();
    var myCookie = $.cookie('chat')=='yes'?"no":"yes";
    $.cookie('chat', myCookie, {expires:1});
});
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top