Assuming you identify check boxes using the "name" attribute, you
could just use the following:
var values = {};
$("input:checkbox").each(function(){
values[$(this).attr("name")] = $(this).attr("checked") ? true : false;
});
So, if we had:
<input type="checkbox" name="chk1" checked="checked"/>
<input type="checkbox" name="chk2" />
<input type="checkbox" name="chk3" checked="checked"/>
<input type="checkbox" name="chk4" />
We would get this:
values = {chk1:true,chk2:false,chk3:true,chk4:false}
- jake
On 3/13/07, Peter Gordon <[EMAIL PROTECTED]> wrote:
> I have a list of checkboxes in a form, some ticked some not.
>
> I use .post to send information to the server. How can I force the
> checkbox information to be sent even if it is unchecked? I need a
> generic solution.
>
> Thanks,
>
> Peter
>
>
>
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/