Reputation: 583
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
Upvotes: 0
Views: 94
Reputation: 32608
This is probably what you want. It grabs a column, duplicates it, sets the input to "" and inserts it before the "add" button
Upvotes: 1
Reputation: 69915
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));
});
Upvotes: 1
Reputation: 2101
Use var input = $(".ai_service").find(":eq(0)").html();
instead. See http://jsfiddle.net/539LR/4/ for reference
Upvotes: 0