HTML escape using Document - Node.js String

Node.js examples for String:HTML String

Description

HTML escape using Document

Demo Code


String.prototype.htmlEscape = function(){
    var span = document.createElement('span');
    var txt =  document.createTextNode('');
    span.appendChild(txt);//from  www .  ja  va 2  s .  co m
    txt.data = this;
    return span.innerHTML;
};

Related Tutorials