Possible Duplicate:
Obtain form input fields using jQuery?
I have a form with many input fields.
What is the easiest way to get all the input fields of that form in an array?
Or the Object in Key:Value pair
Possible Duplicate:
Obtain form input fields using jQuery?
I have a form with many input fields.
What is the easiest way to get all the input fields of that form in an array?
Or the Object in Key:Value pair
 
    
     
    
    Use the serializeArray() jQuery function:
var fields = $('#formID').serializeArray();
To get an associative array of the data (a JSON Object with name/value mappings), have a look at the code here: https://stackoverflow.com/a/1186309/349012
Object of all the inputs:-
$("form#formId :input").each(function(){
    var input = $(this); // A jquery object of the input
});
or
$('#formId').submit(function() {
    // get the array of all the inputs 
    var $inputs = $('#formId :input');
    // get an associative array of the values
    var values = {};
    $inputs.each(function() {
        values[this.name] = $(this).val();
    });
});
This one returns the Key:Value pair -
var values = {};
$.each($('#formId').serializeArray(), function(i, field) {
    values[field.name] = field.value;
});
 
    
    This is pretty easy:
$('input','#formId')
or
$('#formId').find('input');
