Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js escape html

function escapeHtml(text) {
  return text
      .replace(/&/g, "&")
      .replace(/</g, "<")
      .replace(/>/g, ">")
      .replace(/"/g, """)
      .replace(/'/g, "'");
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #js #escape #html
ADD COMMENT
Topic
Name
8+7 =