dimanche 16 mai 2021

Remove orphaned HTML tags [closed]

I have a javascript string that represents an HTML code, I want to remove any [not closed] HTML tags

Example:

<p>Lorem <b>ipsum</p>
<img src='...'>
<p>Vestibulum sodales ex sit amet <span> risus condimentum</p>`

I want the result to be:

<p>Lorem ipsum</p>
<img src='...'>
<p>Vestibulum sodales ex sit amet risus condimentum</p>`



Aucun commentaire:

Enregistrer un commentaire