Created
January 6, 2017 15:51
-
-
Save Alex-xd/346c1bdaa3b96c71c16311a4c8140ac3 to your computer and use it in GitHub Desktop.
转义HTML
This file contains 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 escapeHTML(a) { | |
a = "" + a; | |
return a.replace(/&/g, "&").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