Load HTML with ajax, initzializing select2 fails

Hi

I have a list of html-containers with select dropdowns in it. after calling $(element).select2(); these work.

Then I’d like to load a new list item and append it to the list and “activate” the select-dropdown in the returned html contents.

I tried different ways of doing this but I get only these two results:

a) To all existing “selects” a second one is appended
b) the new select works, but all others miss their options, instead “No results found” shows up as only option in the dropdown.

How can I initialize select2 on the new elements without touching the ones already present?

Simon

Without seeing your HTML and JavaScript code, it’s hard to analyze what might be going on. Can you post your code to jsfiddle.net or codepen.io?