JSFiddle - React, Tailwind, and code Playground
by Mahngiel
HTML
<div>
<li>
<script> document.write('one'); </script> (<span>0</span>)
</li>
<li>
<script> document.write('two'); </script> (<span>2</span>)
</li>
<li class=solo>
three (<span>3</span>)
</li>
</div>
CSS
div {background-color: #f1f1f1;}
JavaScript
/*
* Since we're performing onLoad, so all dependent plugins
* are loaded, this means the language has already been modified
* Thus, we don't require the lang setter
*/
$('li').each(function() {
// ID our target
var text = $(this).html();
// strip script tags from and trim
var langd = $.trim( text.replace(/\<scr(.*)ipt>/g, '') );
// remove parens
var clean = langd.replace(/\(<span/g, '<span').replace(/span>\)/g, 'span>');
// return clean
$(this).html( clean );
});