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