javascript - Replacing nesting of text tags such as with in an HTML element? -


I have an internal HTML division which is very much like:

  & lt; B & gt; First & lt; Span class = "red" & gt; From & lt; / Span & gt; & Lt; / B & gt; & Lt; Span class = "red" & gt; For the third position & lt; / Span & gt; Urth fift & lt; Span class = "large" & gt; H sixth and lieutenant; Span & gt;   

This markup may contain text adatting tags because it is the output of the text-editing library.

For whatever I am working on, I need to remove any nesting victim. Therefore, ideally, the above markup string should be:

    

To give some context, the markup Wysihtml5 text editor is produced at the top, which is very useful, but I need a markup so that the markup is required to be second enabled

Try it out:

  $ (document) .ready (function () { $ ('B'). (Function () {var text = $ (this). Html (); $ (this) .replaceWith ('& lt; span style = "font-weight: bold; color: red" & gt; '+ text +' & lt; / span & gt; ';);});});   

Object:

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -