Display HTML code to plain text

5.9k views Asked by At

I need help with including HTML code as plain text on my page. Could you tell me the best way how to place the code on my page between <section> & </section> tags?

Something like this:

Example

Thanks in advance!

So I want to place the HTML code like the w3schools posted this HTML Example on their page with the all tags and tags are colored.

3

There are 3 answers

1
Taplar On
$(selector).text( ... )

The use of the text() function sets the value as a TextNode, which will cause the html not to render on the page.

3
Geomorillo On

< code>< /code> Perhaps with this tag you can do it

<code><h1>Mi header</h1></code>
0
Bzzoiro On

You can use <pre></pre>

For example:

This is me code