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

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -