开发者

Adding input in jQuery and problem adding several input with a click

Why after a click on add, adding several input together?

I want once times add input in each click on add.

you see yourself开发者_JS百科 : my code


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));

});


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜