Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

html escape function javascript

function escapeHTML(text) {  
    var replacements= {"<": "&lt;", ">": "&gt;","&": "&amp;", """: "&quot;"};                      
    return text.replace(/[<>&"]/g, function(character) {  
        return replacements[character];  
    }); 
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #html #escape #function #javascript
ADD COMMENT
Topic
Name
4+7 =