New controller instance created via javascript

If a new stimulus controller instance is added to the page via javascript, how do I get it initialized?

Controllers are automatically initialized regardless of how/when they’re added to the page:

Stimulus works by continuously monitoring the page, waiting for the magic data-controller attribute to appear.

https://stimulusjs.org/handbook/introduction#connecting-html-to-javascript

Thank you, I’m not sure what the issue was before, but it is working as expected.

What about dynamically added targets? Those don’t appear to be picked up stimulus automatically.

Yes they are as long as they are inside the controller element and scoped correctly with the controller name