ok, that is much better context

well this is an idea i havent tested this on an actual piece of code but should 
work with lil modifications in the case does not work

assume fn.ready

//get local storage or cookie value and store this on var setting

if(setting === true){
        // code to display the correct content here
}else{
        // code to display the other content here
}

// in case this is the settings page where the checkbox is
$('#my_checkbox').attr('checked', stored value);

$('#my_checkbox').bind('click', function(){
        if(this.checked){
                // save to local storage or cookie as true
        }else{
                // save to local storage or cookie as false
        }
});

i hope this helps.

On Jan 17, 2011, at 12:33 AM, Shawn Stringfield wrote:

> I'm actually experimenting with localStorage and cookies. When a user comes 
> to a page, I will give them the option of seeing the page layout with 
> thumbnails vs. details of images. The layout is based on them clicking a 
> checkbox for thumbnails or a checkbox for details. I hope this is more 
> descriptive of what I'm trying to accomplish.
> 
> From: fernando trasvina <[email protected]>
> Reply-To: JSMentors <[email protected]>
> Date: Mon, 17 Jan 2011 00:22:59 -0600
> To: JSMentors <[email protected]>
> Subject: Re: [JSMentors] Saving checkbox state in jquery.
> 
> checkboxes have checked attribute you could pass checked true if it was 
> checked.
> 
> i dont know if you are trying to do something more complex a lil more info 
> may help.
> 
> On Jan 17, 2011, at 12:16 AM, Shawn Stringfield wrote:
> 
>> How do I save checkbox state using jquery? Do I need to use php session 
>> variables and pass that on to jQuery?
>> 
>> I'm trying to save a cookie session based on a user's selection of a 
>> checkbox but of course the checkbox clears everytime you quit the browser.
>> 
>> -- 
>> To view archived discussions from the original JSMentors Mailman list: 
>> http://www.mail-archive.com/[email protected]/
>>  
>> To search via a non-Google archive, visit here: 
>> http://www.mail-archive.com/[email protected]/
>>  
>> To unsubscribe from this group, send email to
>> [email protected]
> 
> 
> -- 
> To view archived discussions from the original JSMentors Mailman list: 
> http://www.mail-archive.com/[email protected]/
>  
> To search via a non-Google archive, visit here: 
> http://www.mail-archive.com/[email protected]/
>  
> To unsubscribe from this group, send email to
> [email protected]
> 
> -- 
> To view archived discussions from the original JSMentors Mailman list: 
> http://www.mail-archive.com/[email protected]/
>  
> To search via a non-Google archive, visit here: 
> http://www.mail-archive.com/[email protected]/
>  
> To unsubscribe from this group, send email to
> [email protected]

-- 
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to