2

How to clone a Select2 element?

https://jsfiddle.net/yhxtLqq6/

var clone = $('.select').clone();
$('body').append(clone);

It doesn't work properly...

Den
  • 283
  • 1
  • 9
  • Please look at the marked duplicate at the use of `destroy` i.e: `$(".select").select2("destroy");`. Ones destroyed, clone the element and **re-initilize** the select2 `$('.select').select2({....})` - You should check the documentation on `select2` to see how it works and inspect the DOM so you know what it does. – Nope Mar 06 '18 at 12:35
  • 1
    You would need to destroy and recreate the select 2: https://jsfiddle.net/yhxtLqq6/54/ – Pete Mar 06 '18 at 12:38

0 Answers0