Return to Snippet

Revision: 8717
at October 4, 2008 13:38 by vasilije


Initial Code
$('#myForm').submit(function() {
    // get all the inputs into an array.
    var $inputs = $('#myForm input, #myForm textarea, #myForm select');

    // not sure if you wanted this, but I thought I'd add it.
    // get an associative array of just the values.
    var values = {};
    $inputs.each(function(i, el) {
        values[el.name] = $(el).val();
    });

});

Initial URL


Initial Description


Initial Title
get form input fields with jQuery

Initial Tags
javascript, jquery

Initial Language
JavaScript