jquery - Regex in Javascript to remove nested paragraphs -
<p style="text-align: right;"> <p style="text-align: center;"> <p style="text-align: left;"> <p style="text-align:center;"> leave content </p> </p> </p> </p> <br>
save content , last paragraph style has been applied,
<p style="text-align: right;">
for concrete case provided try simple code:
var elementtokeep = $('selectortoparagraph'); elementtokeep.html(elementtokeep.text());
for more universal cases you'll have use html parser.
Comments
Post a Comment