preventing html and script injection in javascript code example
Example: avoid html injection
//You can encode the "<" and ">" to their HTML equivelant
html = html.replace(/</g, "<").replace(/>/g, ">");
//You can encode the "<" and ">" to their HTML equivelant
html = html.replace(/</g, "<").replace(/>/g, ">");