Adding input in jQuery and problem adding several input with a click
-
22-10-2019 - |
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
Solução
Try this js fiddle I think I have done wat you wanted.
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
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