<select> is not converted to select2

Hi all.
Can’t convert to select2.
HTML is generated dynamically .
when generated:

if i want to convert I do: $("#ddlansStep0BPCoordinator").select2(); and it doesn’t work, shows me as it is. But if I’m trying to convert

$("#ansStep0BPCoordinator").select2() it works for
.
I’m new in select2 so don’t know where to find the issue.
Thanks.

I don’t quite understand your post, because it appears some words are missing. But you mentioned that the HTML is being generated dynamically. Where is that happening—on the server, or on the browser? If it’s on the browser, you must ensure that all of the HTML is generated before executing your JavaScript that initializes the Select2.

Thank you John, the issue is fixed