# What controls the order of execution for Theme components' j/s?

**URL:** https://meta.discourse.org/t/what-controls-the-order-of-execution-for-theme-components-j-s/190410
**Category:** Development
**Created:** [May 14, 2021, 12:17pm UTC](https://meta.discourse.org/t/what-controls-the-order-of-execution-for-theme-components-j-s/190410 "2021-05-14T12:17:05Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [May 26, 2021, 4:59pm UTC](https://meta.discourse.org/t/what-controls-the-order-of-execution-for-theme-components-j-s/190410/5 "2021-05-26T16:59:52Z")

</div>

Pretty sure that the component execution order is [not based on the name of the component](https://meta.discourse.org/t/theme-component-order-of-precedence/156615/5). It’s based on the ID by default.

That said, you _can_ set initializer order for advanced use cases. I can put DiscoTOC in a named initializer so you can run your code before DiscoTOC, but I need to know what you’re trying to do first to give you a clear answer.

> [@craigconstantine](#):
>
> modifying the DOM by adding elements

Your modifications here are based on an HTTP/AJAX request, correct?

---

_[View the full topic](https://meta.discourse.org/t/what-controls-the-order-of-execution-for-theme-components-j-s/190410)._
