Pergunta

Why after a click on add, adding several input together?
I want once times add input in each click on add.
you see yourself : my code

Foi útil?

Solução

Try this js fiddle I think I have done wat you wanted.

http://jsfiddle.net/539LR/6/

Here is the js code

$('a.add_input').live('click', function (e) {
    e.preventDefault();
    var $column = $(this).closest("div.column");
    var input = $column.prev("div.column").clone().wrap("<div />").parent().html();
    $column.before($(input));

});

Outras dicas

This is probably what you want. It grabs a column, duplicates it, sets the input to "" and inserts it before the "add" button

http://jsfiddle.net/n4YFK/1/

Use var input = $(".ai_service").find(":eq(0)").html(); instead. See http://jsfiddle.net/539LR/4/ for reference

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top