BrokeMyLegBiking BrokeMyLegBiking - 5 months ago 13
jQuery Question

jquery to serialize only elements within a div

I would like to get the same affect as jQuery.serialize() but I would like to return only the child elments of a given div.

sample result:

single=Single2&multiple=Multiple&radio=radio1

Answer

No problem. Just use the following. This will behave exactly like serializing a form but using a div's content instead.

$('#divId :input').serialize();

Check http://jsbin.com/azodo for a demonstration (http://jsbin.com/azodo/edit for the code)

Comments