HTML5 specifies that a
<script>
tag inserted withinnerHTML
should not execute.
Update:
Aside: Phoenix 1.4 uses webpack as a bundler and LiveView itself uses modular JavaScript - so I wouldn’t recommend mixing that with non-modular JavaScript - even it it seems to work in the short term.