JSFiddle - React, Tailwind, and code Playground
HTML
<div id="your-div">
just <span>a</span> test
<a href="http://www.google.de">m<span class="test">o</span>o</a>
<div class="test2">hehehe</div>
<span class="test">meow</span>
</div>
<button>Remote span attributes</button>
CSS
.test { color: #f00; }
.test2 { color: #0a0; }
JavaScript
$('button').click(function(e) {
e.preventDefault();
$('#your-div span').each(function() {
var elem = this;
$.each(elem.attributes, function(i, attr) {
$(elem).removeAttr(attr.name);
});
});
});