質問

The code is very simple and can be view on jsfiddle.

Basically, whenever I clone something I need to recall the plugin so it can work on the clone. Unfortunately, it duplicates the info.

$(document).on('click', '.add', function(){
    $(".content").append($(".tbl").last().clone());

   // $(".categories").chosen(); this makes duplicate
});

With the line commented it simply does not work.

役に立ちましたか?

解決

I'm not sure this is OK for you, but instead of cloning the whole table, you can clone the select itself:

$(document).on('click', '.add', function () {
    var $clone = $(".tbl select").last().clone();
    $(".content").append($clone);
    $clone.chosen();
});

Updated Fiddle

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top