Skip to content

Instantly share code, notes, and snippets.

@lanqy lanqy/gist:2597472 forked from padolsey/gist:579493
Created May 4, 2012

Embed
What would you like to do?
function htmlEntities(str) {
return String(str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.