Open Manjushaka opened 7 years ago
function htmlEncode(value){ // Create a in-memory div, set its inner text (which jQuery automatically encodes) // Then grab the encoded contents back out. The div never exists on the page. return $('<div/>').text(value).html(); }
function htmlDecode(value){ return $('
如:
if (this.input) { jsonData.fText = $('<div />').text(jsonData.text).html().replace(new RegExp($('<div />').text(this.input).html(), 'g'), `<em>${this.input}</em>`); } else { jsonData.fText = $('<div />').text(jsonData.text).html(); }
function htmlDecode(value){ return $('
').html(value).text(); }