Pergunta

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.

Foi útil?

Solução

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top