Created
October 7, 2013 12:30
-
-
Save paulund/6867068 to your computer and use it in GitHub Desktop.
Apply PHP htmlentities in JS.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function htmlEntities(str) { | |
return String(str).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment