JQuery clone input and delete value in cloned

What I am trying to archive clones my “box” and has a clone with no values. Therefore, the inputs must be empty. I have this fiddle, only with function and html. The hope is clear, and you guys can help me.

http://jsfiddle.net/XeELs/117/

addAddress: function() {
    var cloneCount = 0;
    $copy = $("#scroll .first").first().clone().attr("id", "to-add-first_Clone" + cloneCount).addClass('cloned'); //add a new class cloned to the cloned outerDivs
    $(".clone", "#to-add-first_Clone" + cloneCount).attr("id", "clone_Clone" + cloneCount);
    cloneCount++;
    //check breakpoints
    var $last_bp = $('#scroll .wrap .breakpoint').last();
    var $first = $(".first", $last_bp).length;
    if ($first > 2) {
        //move this into a new breakpoint
        $('#scroll .wrap').append('<div class="breakpoint"/>');
        $last_bp = $('#scroll .wrap .breakpoint').last();
    }
    $last_bp.append($copy);
    this.drawNavigation();
},
+3
source share
1 answer

I think that is the essence of what you are trying to do.

http://jsfiddle.net/XeELs/132/

The newly cloned box will have empty input values. Links to the delete address are displayed intellectually, and I added logic to create new "unique" identifiers.

+6
source

All Articles