+ 3

How to inject <script> with innerHTML?

For example, it SHOULD work like this (I know it's a silly example): <div id="div"></div> <script> var div = document.getElementById(div); div.innerHTML = <script>document.write("test"); </script> </script>

7th Mar 2019, 4:54 PM
Meiki
Meiki - avatar
4 Answers
+ 1
Andrew G How should I use eval()?
8th Mar 2019, 11:54 AM
Meiki
Meiki - avatar
+ 1
Thank you it works!
8th Mar 2019, 5:51 PM
Meiki
Meiki - avatar