views:

134

answers:

1

I'd like to strip certain elements from my HTML document. It seems that removing some tags simply doesn't work.

For example - strip all stylesheets:

$("style",this._doc.body).remove();

I'd also like to remove comments or something like weird winword tags like: <!--[if gte mso 9]>

How to do it?

+1  A: 

To remove all stylesheets, try this:

$('link[rel=stylesheet]').remove();
danilo
would it be possible also stripping all style definitions? like <style>...</style>
Fuxi
yes, iirc try $('style').remove();if that doesn't work, try $('style').each(function() { $(this).remove(); });
danilo