ngplayground
ngplayground

Reputation: 21627

Hide or remove spans from a block of pregenerated html

Is it possible to remove all the spans or event the element styling from them?

They are created by VBulletin so I cant manually do it

<div class="thanklist">
        <a href="member.php?u=1394" rel="nofollow"><span style="color: #F3484E; font-weight:bold;">mynameisdonald</span></a>
        <a href="member.php?u=1394" rel="nofollow"><span style="color: #F3484E; font-weight:bold;">mynameisdonald</span></a>
</div>

Upvotes: 1

Views: 66

Answers (3)

Ram
Ram

Reputation: 144689

Yes, you can use removeAttr() method, try the following:

$('.thanklist span').removeAttr('style');

DEMO

Or if you want to remove them the spans you can use remove() method:

$('.thanklist span').remove();

DEMO

Upvotes: 4

mVChr
mVChr

Reputation: 50185

​$('.thanklist span').each(function(i, el){
    $(this).parent().html($(this).html());
});​​​​​​​​​​​​​​​​​

Upvotes: 1

Michael Peterson
Michael Peterson

Reputation: 1123

Could you add a css class:

span {
   display: none;
}

Upvotes: 0

Related Questions