Escape the characters that HTML gives a meaning to (&, <, >, " and '), so text from somewhere you don't control (a user's name, say) shows as itself when put into innerHTML or an attribute value, instead of becoming markup or script.
&
<
>
"
'
innerHTML
The text to escape.
Escape the characters that HTML gives a meaning to (
&,<,>,"and'), so text from somewhere you don't control (a user's name, say) shows as itself when put intoinnerHTMLor an attribute value, instead of becoming markup or script.