html escape function javascript
function escapeHtml(str) {
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
}function escapeHTML(text) {
var replacements= {"<": "<", ">": ">","&": "&", """: """};
return text.replace(/[<>&"]/g, function(character) {
return replacements[character];
});
}
Also in JavaScript:
- regular expression number from 1 to 100
- flutter use valuechanged function in function
- elements under p5 canvas
- import path nodejs
- get params js
- how to save in p5 js
- jquery external script
- how to fetch first 10 characters of a string in node js
- get id by this jquery
- change value of drop down using jquery
- javascript array.find
- remove special characters from string javascript
- How to abreviate digits in js
- javascript convert comma separated string to array
- change the border of an image js
- sort array based on another array
- js image on canvas
- angular material multi select ngmodel
- open pdf in new tab javascript
- jquery textarea autosize
- print("Google") in JavaScript
- change input placeholder text jquery
- switch js
- rock paper scissors javascript