I am trying to embed raw html code into a webpage using javascript. Please tell me what I am doing wrong
<div class="header-note">
<h4>New version available</h4>
<p id="version"></p>
</div>
<script>
const version = document.getElementById("version");
const rawCode = "<h1>Test</h1> <p>Hello World</p>"
version.innerText = rawCode
</script>
I will be rendering rawCode from firebase which I know how to do it's just converting the raw code to read correctly.
currently outputs:
<h1>Test</h1> <p>Hello World</p>
I need output to be:
Test
Hello World
HERE YOU GO
const version = document.getElementById("version"); const rawCode = "<h1>Test</h1> <p>Hello World</p>" version.innerHTML = rawCode
<div class="header-note"> <h4>New version available</h4> <p id="version"></p> </div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.