Skip to content

Instantly share code, notes, and snippets.

@vishnukumarpv
Created September 5, 2016 11:19
Show Gist options
  • Save vishnukumarpv/9a14e1b4ff8b90c0038a55312294cfeb to your computer and use it in GitHub Desktop.
Save vishnukumarpv/9a14e1b4ff8b90c0038a55312294cfeb to your computer and use it in GitHub Desktop.
html entities removeing javascript
function htmlEscape(s) {
return (s + '').replace(/&/g, '&')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
.replace(/'/g, '&#039;')
.replace(/"/g, '&quot;')
.replace(/\n/g, '<br />');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment