title: Character count in innerHTML
body: <p>In html, how to count the real characters shown in a innerHTML?</p>
  
  <p>For example, In <code>&lt;strong&gt;Hi&lt;/strong&gt;</code>, the # of characters should be 2, not 19.</p>
  
  <p>I've tried 2 methods which do not work:</p>
  
  <ol>
  <li><code>str.length</code> - This will include <code>&lt;&gt;</code> characters.</li>
  <li><code>getElementById</code> - This will include <code>&lt;&gt;</code> characters:</li>
  </ol>
  
  <p>I tried as follows: </p>
  
  <pre><code>elem_output = document.getElementById("example_id"); 
  elem_output.innerText.length;//1st
  elem_output.textContent.length;//2nd
  </code></pre>