Answers for "html special characters escape js"

1

javascript escape html

function escapeHtml(str) {
    return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
}
Posted by: Guest on July-31-2019

Code answers related to "html special characters escape js"

Browse Popular Code Answers by Language