# How To run scripts after dom has loaded

**URL:** https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750
**Category:** Ember Data
**Created:** [September 7, 2015, 1:09pm UTC](https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750 "2015-09-07T13:09:13Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![mainakibui](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@mainakibui](https://discuss.emberjs.com/u/mainakibui)
#### Post date: [September 7, 2015, 1:09pm UTC](https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750/1 "2015-09-07T13:09:13Z")

</div>

Wssup good people.

How does one load scripts after all the elements have been inserted into the DOM?

I am trying to instantiate bootstrap affix and a number of other other jquery plugins

---

<div class="post-metadata">

### Author: ![xcambar](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/xcambar/32/11309_2.png) [@xcambar](https://discuss.emberjs.com/u/xcambar)
#### Post date: [September 7, 2015, 10:36pm UTC](https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750/2 "2015-09-07T22:36:29Z")

</div>

`didTransition` will help; see [Is there an event after the template has been added to the outlet? - #2 by xcambar](http://discuss.emberjs.com/t/is-there-an-event-after-the-template-has-been-added-to-the-outlet/8737/2).

---

<div class="post-metadata">

### Author: ![jasonmit](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/jasonmit/32/182_2.png) [@jasonmit](https://discuss.emberjs.com/u/jasonmit)
#### Post date: [September 7, 2015, 11:58pm UTC](https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750/3 "2015-09-07T23:58:12Z")

</div>

> [@mainakibui](#):
>
> How does one load scripts after all the elements have been inserted into the DOM?

`didInsertElement` when dealing with components. [http://emberjs.com/api/classes/Ember.Component.html#event\_didInsertElement](http://emberjs.com/api/classes/Ember.Component.html#event_didInsertElement)

There is also `didRender` if you’re dealing with 1.13.0 and above:

> **[Ember.js 1.13.0 and 2.0 Beta Released](https://blog.emberjs.com/ember-1-13-0-released/)**
>
> We are pleased to announce the release of both Ember.js 1.13.0 and the first beta in the 2.0 series. This comes as the thirteenth cycle of our release process...

---

<div class="post-metadata">

### Author: ![xcambar](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/xcambar/32/11309_2.png) [@xcambar](https://discuss.emberjs.com/u/xcambar)
#### Post date: [September 8, 2015, 9:14am UTC](https://discuss.emberjs.com/t/how-to-run-scripts-after-dom-has-loaded/8750/4 "2015-09-08T09:14:11Z")

</div>

Much better than my answer, @jasonmit .

As I understand it, when manipulating DOM nodes, `didInsertElement` is better when the manipulations are on static nodes and/or root node of the component, but `didRender` is better for dynamic nodes (i.e. with binding).

What do you think?
