# External Dom modifying js libraries

**URL:** <https://discourse.elm-lang.org/t/external-dom-modifying-js-libraries/6165>\
**Category:** Learn\
**Created:** [August 18, 2020, 9:28am UTC](https://discourse.elm-lang.org/t/external-dom-modifying-js-libraries/6165 "2020-08-18T09:28:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nikolis\_Galerakis](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/nikolis_galerakis/32/2479_2.png) [@Nikolis\_Galerakis](https://discourse.elm-lang.org/u/Nikolis_Galerakis)\
**Post date:** [August 18, 2020, 9:28am UTC](https://discourse.elm-lang.org/t/external-dom-modifying-js-libraries/6165/1 "2020-08-18T09:28:27Z")

</div>

Hello fellas,

I have been looking at customer help desk solutions and LiveAgent got my attention. And I would like to ask if their concept can somehow be used with elm because I can’t seem to get it right.

The idea is that they give you a scrpt like the following

```
<script type="text/javascript">
(function(d, src, c) { var t=d.scripts[d.scripts.length - 1],s=d.createElement('script');s.id='la_x2s6df8d';s.async=true;s.src=src;s.onload=s.onreadystatechange=function(){var rs=this.readyState;if(rs&&(rs!='complete')&&(rs!='loaded')){return;}c(this);};t.parentElement.insertBefore(s,t.nextSibling);})(document,
'https://companyname.ladesk.com/scripts/track.js',
function(e){ LiveAgent.createButton('fuyr39qr', e); });
</script>

```

Which you have to copy and paste just before your closing html tag.  
I have tested it with a plane html file and what it does is using an i frame to invoke code which generates the neccecery widgets in your page, but as I expected it does not work just like that with elm because of the dom modifications I guess.

So questions is: Is there any way that I can integrate such a “library” with elm or is it just not gonna work for me ?

Any directions will be greatly appriciated!

---

<div class="post-metadata">

**Author:** ![Nikolis\_Galerakis](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/nikolis_galerakis/32/2479_2.png) [@Nikolis\_Galerakis](https://discourse.elm-lang.org/u/Nikolis_Galerakis)\
**Post date:** [August 18, 2020, 10:50am UTC](https://discourse.elm-lang.org/t/external-dom-modifying-js-libraries/6165/2 "2020-08-18T10:50:16Z")

</div>

I found out that the particular code acts uppon a node,  
and I modified the node to be a custom element and the above code is being called  
after the node is rendered from elm (through the connectedCallback) to the page and so I now have the expected behaviour.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [August 28, 2020, 10:50am UTC](https://discourse.elm-lang.org/t/external-dom-modifying-js-libraries/6165/3 "2020-08-28T10:50:16Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
