Original source: http://blog.csdn.net/xuzengqiang2/article/details/41979733
Introduction: Given that the text is the data that is fetched from the rich editor, sometimes we may not need to display the format, so we need to remove the HTML tags and just need the text.
Mode one: Use Innertext,jquery to use text ()
InnerText will automatically remove HTML tags
<span class= ' Content_hidden ' style= ' display:none ' >${info.content}</span> <div ' class= '
ID = "Content_div" style= "Height:auto"; >
Introduction £ <span id= "content_body" ></span>
</div>
Then set the value through JS:
$ ("#content_body"). Text ($ (". Content_hidden"). Text ());
Mode two: Use regular expressions to delete HTML tags:
function Delhtmltag (str) {return
str.replace (/<[^>]+>/g, "");//Remove all HTML tags
}
$ ("#content_ Body "). Text (Delhtmltag (" ${info.content} "));
And so on .....