I want to grab all the inputs inside a form, in order to submit them.
The point of this is to use jquery's ajax to submit a dynamically sized form.
Surely there must be an array inside the dom somewhere which i can just do something like...
docment.forms['form'].elements
which only lists inputs for that form, meaning I can loop through them and grab their values to play around with?
views:
19answers:
2
+1
A:
You can use the :input
selector for this.
$('#formid:input')
Alternatively, you can also use the jQuery.serialize() function to serialize all inputs into a ready-to-use query string for the jQuery.ajax()'s data
parameter.
$('#formid').submit(function() {
alert($(this).serialize());
return false;
});
BalusC
2010-05-01 15:12:53