Adding form inputs in javascript (jquery)

Posted by matthewsteiner on Stack Overflow See other posts from Stack Overflow or by matthewsteiner
Published on 2010-04-15T03:32:59Z Indexed on 2010/04/15 3:43 UTC
Read the original article Hit count: 109

Filed under:

I understand that you do something like:

$('form').append('<input type="text" name="color-1" value="Hello" />');

But I have two questions about it. First off, I don't want it added to the end of the form, but after the last input in the "color" section. Secondly, where "name=color-1", I need the one to increment if they want to add more than one input, you know? So that I can process it on the server.

Any ideas?

© Stack Overflow or respective owner

Related posts about jQuery