Is it possible to remove all DIVs on a page via jQuery -- keeping their content intact -- which have this pattern to them?
<div class="ExternalClass85AC900AB26A481DBDC8ADAE7A02F039">....</div>
Note that the DIVs follow this pattern:
class name will always start with ExternalClass
but will be followed by another value, never the same,
and the DIV has no other attributes but class
. (This is on SharePoint)
Thanks.
Yes, you can use the attribute starts with selector and the replaceWith method:
$('[class^="ExternalClass"]').filter(function() {
return this.attributes.length === 1;
}). replaceWith(function() {
return $(this).html();
});
$('[class^="ExternalClass"]').replaceWith(function() {
return $(this).html();
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With