title: How can I display HTML tags as Text using jQuery?
body: <p>I am trying to display unrendered HTML code using class <code>html</code> and the below jquery code.
  Its working for every tag except for tags <code>&lt;html&gt;</code>, <code>&lt;head&gt;</code> and <code>&lt;body&gt;</code>.
  Is there a way these can also be displayed as text?</p>
  
  <pre><code>$(document).ready(function () {
      $('.html').each(function () {
          $(this).text($(this).html());
      });
  });
  </code></pre>
  
  <p>HTML code:</p>
  
  <pre><code>&lt;pre&gt;
  &lt;div class="html"&gt;
      &lt;html&gt;
      &lt;head&gt;&lt;title&gt;Title&lt;/title&gt;&lt;/head&gt;
      &lt;body&gt;
      &lt;p&gt;Unrendred html&lt;/p&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  &lt;/div&gt;
  &lt;/pre&gt;
  </code></pre>
  
  <p>Expected content:</p>
  
  <pre><code>&lt;div class="html"&gt;
      &lt;html&gt;
      &lt;head&gt;&lt;title&gt;Title&lt;/title&gt;&lt;/head&gt;
      &lt;body&gt;
      &lt;p&gt;Unrendred html&lt;/p&gt;
      &lt;/body&gt;
      &lt;/html&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Actual content:</p>
  
  <pre><code>&lt;title&gt;Title&lt;/title&gt;
  
  &lt;p&gt;Unrendred html&lt;/p&gt;
  </code></pre>