Posted By

lfatr on 02/16/10


Tagged

entity decode


Versions (?)

HTML_ENTITY_DECODE


 / Published in: JavaScript
 

  1. function html_entity_decode(str) {
  2. try {
  3. var tarea=document.createElement('textarea');
  4. tarea.innerHTML = str; return tarea.value;
  5. tarea.parentNode.removeChild(tarea);
  6. } catch(e) {
  7. //for IE add <div id="htmlconverter" style="display:none;"></div> to the page
  8. document.getElementById("htmlconverter").innerHTML = '<textarea id="innerConverter">' + str + '</textarea>';
  9. var content = document.getElementById("innerConverter").value;
  10. document.getElementById("htmlconverter").innerHTML = "";
  11. return content;
  12. }
  13. }

Report this snippet  

You need to login to post a comment.