Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function htmlspecialchars(text) {
- var specialChars = {
- "<": "<",
- ">": ">",
- "'": "'",
- '"': """,
- "&": "&"
- };
- return text.replace(/[<>'"&]/g, function(s) { return specialChars[s] });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement