Loop throught form inputs

Posted by Victor on Stack Overflow See other posts from Stack Overflow or by Victor
Published on 2011-11-24T17:34:22Z Indexed on 2011/11/24 17:51 UTC
Read the original article Hit count: 260

Filed under:
|
|
|

I have a form with lots of inputs. I want to get each id and value and then put them in $.load method. I tried this:

$("#form input").each(function() {
    var name = $(this).attr("id");
    var value = $(this).attr("value");
    $.extend(params, {
        name, value
    });
});

and then use $.load("script.php", params);

But obviously it doesn't work. In params I have only one element "name". And I'm not sure I should use extend method too.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about forms