How do you use serialize()/ serializeArray()?
Hi
I am got this html controls
<input value="555555" type="text" id="mytext" runat="server" />
<input type="checkbox" value="1" />
<input type="checkbox" value="2" />
<input type="button" id="submit" />
and now I want to do on button click I want to use the serialize method to grab the checkboxes.
but it does not seem to be working.
$(function()
{
$("#submit").click(function()
{
var fields = $(":checkbox").serializeArray();
jQuery.each(fields, function(i, field)
{
$("#results").append(field.value + " ");
});
});
});
But nothing every gets found whats up with that? I used the firebug debugger to see if anyting was stored in fields and nothing was stored.
I basically got this from the jquery library and just switched what they had a bit around(basically :input to :checkbox)