I am trying to replace the contents of a div with a script using innerHTML.
Here is generally what the important parts of my HTML looks like:
<script> function replace() {
document.getElementById("area").innerHTML = '<script type="text/javascript" src="SOMELINK"></script>';
</script>
<button onclick=replace()> replace </button>
<div id = "area"> hello </div>
When the button is clicked, I want the div #area to be replaced by the script, such that it shows the contents of the link. I can use innerHTML to replace it with a plaintext, like replace "hello" with "Hello World", but when I include the tags, nothing shows up at all. If I remove the tags, the rest of the url that goes inside the tags shows up. Any idea on what I might be doing wrong, and how I can use javascript to replace a div with a script object?
edit: I had mistyped the script tag, but now its fixed!