//Remove the html tag
function removeHtmlTab(tab) { return tab.replace(/<[^<>]+?>/g,'');//Delete all HTML tags}//Convert normal characters into meaning conversion characters
function html2Escape(sHtml) { return sHtml.replace(/[<>&"]/g,function(c){return {'<':'<','>':'>','&':'&','"':''}[c];}); }//Change the meaning symbol into ordinary characters
function escape2Html(str) { var arrEntities={'lt':'<','gt':'>','nbsp':' ','amp':'&','quot':'"'}; return str.replace(/&(lt|gt|nbsp|amp|quot);/ig,function(all,t){return arrEntities[t];}); }// Convert to space
function nbsp2Space(str) { var arrEntities = {'nbsp' : ' '}; return str.replace(/&(nbsp);/ig, function(all, t){return arrEntities[t]}) }//Enter to br tag
function return2Br(str) { return str.replace(//r?/n/g,"<br />"); }//Remove the beginning and end line breaks, and convert more than 3 consecutive lines to 2 lines breaks
function trimBr(str) { str=str.replace(/((/s|)*/r?/n){3,}/g,"/r/n/r/n");//limit up to 2 line breaks str=str.replace(/^((/s|)*/r?/n)+/g,'');//Clear the beginning line break str=str.replace(/((/s|)*/r?/n)+$/g,'');//Clear the end line breaks return str; }// Combine multiple consecutive spaces into one space
function mergeSpace(str) { str=str.replace(/(/s|)+/g,' '); return str; }The above method of converting HTML escape characters by JS is all the content I share with you. I hope you can give you a reference and I hope you can support Wulin.com more.