Executing js after DOM loaded

What function does your button need to have? You should be able to use a plugin outlet:

https://github.com/discourse/discourse/blob/acd1693dac1bff6ff50250d942134bc48a27ff14/app/assets/javascripts/discourse/templates/components/topic-title.hbs#L5

Check out this section in @Johani’s awesome guide for more on how to make use of them. Depending on the complexity of your button, you may need to use a widget.

6 Likes