How to disable Javascript within <pre><code>javascript here</code></pre>

I’m working on my Technical Documentation project on Code Pen and when I put Javascript code in the <pre><code>javascript code here</code></pre> elements, the Javascript code runs instead of just showing the text. Any ideas what to do to get the Javascript appearing as text? Could you refer me to some technical documentation on what is going wrong?

Are you asking how to make comments? It would help if we could see your codepen.

I’m guessing your JS is inside a <script> element? If so remove the script tags.

Thank you! That worked for the Javascript function code but not for the HTML5 code. I’m going to try removing the angle brackets and maybe <button> too to see what happens.Maybe I’ll try adding backticks too.

For the HTML you have to use HTML Entities for Reserved characters .

I assuming you are writing this… straight up into your <pre>?

<script>
   document.getElementById( "hi" ).innerHTML = "doing something"
</script>

You need to convert your angle bracket using entity code. &lt; and &gt;
The result is here…

<script>