Question: I have a list of checkboxes, that I'd like, when clicked to be added to a cookie using jQuery.

My code is like:

```
<input type="checkbox" value="vat_50" name="vat_50" class="tax">
<input type="checkbox" value="vat_34" name="vat_50" class="tax">
<input type="checkbox" value="vat_12" name="vat_50" class="tax">

```

How would I set the cookie, for the checkboxes above?

I've seen `$.cookie`, but not sure how to implement it.

Thanks

Answer: 
Try this provided you using jquery cookie [plugin](http://plugins.jquery.com/files/jquery.cookie.js.txt)

```
$(document).ready( function() {

    $('input:checkbox').click(function() {
        var name = $(this).attr("name");
        var value = $(this).val();
        $.cookie(name, value, { expires: 365 });//Set the expires time as per your requirement.
    });
});

```
here is a [how to](http://jquery-howto.blogspot.com/2010/09/jquery-cookies-getsetdelete-plugin.html) on setting cookies using jQuery or you could look at [this one](http://www.electrictoolbox.com/jquery-cookies/) please consider the use of [google](http://google.com) HTH