Plain text in pre html tag

Asked

Viewed 33 times

1

I was using the tag <pre> and the tag <code> to insert something that would highlight a piece of code. However, when I write the part of html code in the tags <pre> and <code> they recognize (in case the div I’m using).

Follow the code here and in jsfiddle: http://jsfiddle.net/nqmau36p/1/

In HTML:

<pre>
 <div class="alert warning">
   <b>Ooops!</b> Something glitched.
 </div>
</pre>

How it appears on the page:

Ooops! Something glitched.

How I want you to appear:

<div class="alert warning">
   <b>Ooops!</b> Something glitched.
</div>
  • No, there’s no answer in that

  • It has nothing to do with Javascript

  • 1

    I marked as duplicate of another question that has answers that help you. In the answer I indicated not use Javascript. Exists another also. And with that my answer you can do this: http://jsfiddle.net/nqmau36p/2/

  • 1

    A simple way would be to replace the tags "<" and ">" of HTML by &it’s and &gt. Example without displaying code: <form id="frmTeste"> Example displaying code: ;&it’sid form="frmTeste"&gt

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.