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
-
Are you looking to add a new input, a new .mediumCell or a .column?Dennis– Dennis2011-07-23 21:02:07 +00:00Commented Jul 23, 2011 at 21:02
-
Yes, everything in between classes '.adding', '.ai_service'Mehd S– Mehd S2011-07-23 21:05:58 +00:00Commented Jul 23, 2011 at 21:05
Add a comment
|
3 Answers
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));
});
2 Comments
Mehd S
after click on add several input together adding . Here you can put the code?
ShankarSangoli
I am sorry the link which I pasted was wrong. Please check my edited answer it has the right link as well as the code too.
This is probably what you want. It grabs a column, duplicates it, sets the input to "" and inserts it before the "add" button
Comments
Use var input = $(".ai_service").find(":eq(0)").html(); instead. See http://jsfiddle.net/539LR/4/ for reference
3 Comments
Mehd S
no, i not want adding 1 input(it is Unlimited ), i want with each times click add 1 input in class input that clicked.
Semyazas
then you should remove $(this).remove() from the script, because it removes the add link jsfiddle.net/539LR/5
Mehd S
my problem not remove add input, my problem is: after a click on add, adding several input together