📅  最后修改于: 2022-03-11 15:03:49.543000             🧑  作者: Mango
//escaping HTML with jquery
var dangerousHTML = "";
$("#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, "'");
}