Hello I was wondering if anyone might be able to help me?
this is the jquery?I have two problems that I am hoping somone can help me with?

What I am trying to do is when I click on a checkbox (#Facebook) it will display a div #widget-FB, and when I click on the close link (#widget-FB a.close), I can get it to delete.

questions:
1:WHen I check the checkbox, it will set the cookie. The problem that I am having is that I am having is that hwen i click on the close link, I can't get it to delete the cookie. Can someone let me know what I am doing wrong?

2: I am also wondering if you might know how I can have it so that if I uncheck the checkbox or click on the close link the div will disappear.

<script language="javascript"> 
	   	$(document).ready(function(){
	
	<!--facebook- ->
	 $('#Facebook:checkbox').click(function(){
	    $("#widget-FB").show();
		$.cookie('Facebook', 'shown2');
	    });
		 $('#widget-FB a.close').click(function(){
	    $("#widget-FB").hide();
		$.cookie('Facebook', 'hidden2');
	    });
		    var display2 = $.cookie('Facebook');

    // Set the user's selection for the left column
    if (display2 == 'shown2') {
        $("#widget-FB").show();
    };
    // Set the user's selection for the right column
    if (display2 == 'hidden2') {
       $("#widget-FB").hide();
    };

	
	});
	
	
</script>

thanks,

Aaron

Aaron,

Assuming this cookie plugin is installed, I think you want something like this:

$(document).ready(function(){
	var $widget_FB = $("#widget_FB");
	$('#Facebook').click(function(){
		var checked = $(this).is(':checked');
		$widget_FB[checked?'show':'hide']();
		$.cookie('Facebook', checked?1:null);//session cookie for current path.
		//$.cookie('Facebook', checked?1:null, {expires:7});//peristent 7-day cookie.
		//$.cookie('Facebook', checked?1:null, {path:'/'});//cookie for all paths in the domain.
	});
	$widget_FB.find('a.close').click(function(){
		$('#Facebook').click();
	});
	$widget_FB[$.cookie('Facebook')?'show':'hide']()];
});

(untested)

Airshow

Hello Airshow,

Thank you for your help, this has been a great help. I have it working now.

Thanks,

Aaron

Aaron,

Well done, I guess there was still a bit to do. For example, my code didn't attempt to address left/right columns.

(There is also an erroneous ] at line 13).

Can you mark the thread as "solved" please.

Airshow

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.