Because of the need to remove styles and labels from background data, two simple methods are summed up:
The first type:
HTML:<div class= "Announcementtext" >${(item.content)! </div>JS:/***clearcourseannouncediv () * Removal of html* of course announcements*/ functionClearcourseannouncediv () {varAnnouncedom = $ (". Announcementtext"); Announcedom.each (function(index) {varDtext = $ ( This). html (); varDvalue = Dtext.replace (/<\/?[ ^>]*>/g, ""); $( This). Text (Dvalue); }); }
The second type:
HTML:<div class= ' text-css ' >${(item.content)! </div>JS:/***clearcourseannouncediv () * Remove the html* described on the course module*/ functionClearcourseannouncediv () {varAnnouncedom = $ (". Text-css"); varDtext = ' ', Dvalue= ' '; Announcedom.each (function(){ Dtext = $ (this). html ();
Dvalue = $ (' <p> ' +dtext+ ' </p> '). Text ();
$ (this). Text (Dvalue); }); }
Remove the child node style and HTML tags