jquery escape html string
function escapeHtml(str) {
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}//escaping HTML with jquery
var dangerousHTML = "<script>alert('Badabing Baby!');</script>";
$("#myElementID").text(dangerousHTML); //.text() function will escape and display text
//Alternatively, here is plain Javascript escape function
function escapeHtml(str) {
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}
Also in HTML:
- inner html templates
- simple html document
- html add vertical space below
- html semantic tags mozilla
- let's encrypt ssl not working
- number paragraphs in html
- path in html
- svg circle
- html basic page
- images in html
- p tag
- colspan tag html
- salesforce aura input checkbox
- html create a header
- html how to add an image
- favicon x shortcut icon
- what is relu in tensorflow
- excel vba HTML text with tags to formatted text in an cell
- remove underline html
- how do i make a line in html
- html reorder list aaccording
- vuetify v-text-field bottom padding
- how to download jquery
- html set icon