How to unwrap spans with empty class-Names <span class="">assign </span>?

53 views Asked by At

Does anybody has an idea to remove the <span class="">TEST</span> with jquery or javascript? The innerHTML hier "TEST" shall be preserved. Looks easy but i didn't find an easy way.

1

There are 1 answers

0
patrick On BEST ANSWER

I would try this:

$('span[class=""]').each(function() {
    $(this).replaceWith(this.childNodes);
});

But if you really wanna use unwrap you could use:

$('span[class=""]').each(function() {
    $(this.childNodes).unwrap();
});