function encodeHtml(str) {
    return str.replace(/&/g, '&amp;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;')
            .replace(/"/g, '&quot;');
}
// Encode a string containing HTML so it can be rendered as text.
Encode a string containing HTML so it can be rendered as text.
Encode a string containing HTML so it can be rendered as text .
function encodeHtml(str) {
    return str.replace(/&/g, '&amp;')
            .replace(/</g, '&lt;')
            .replace(/>/g, '&gt;')
            .replace(/"/g, '&quot;');
}
function encodeHtml ( str ) { return str . replace ( / & / g , '&amp;' ) . replace ( / < / g , '&lt;' ) . replace ( / > / g , '&gt;' ) . replace ( / " / g , '&quot;' ) ; }
Encode a string containing HTML so it can be rendered as text.
Encode a string containing HTML so it can be rendered as text .