开发者

jQuery: remove certain elements from HTML document

开发者 https://www.devze.com 2022-12-22 07:47 出处:网络
I\'d like to strip certain elements开发者_StackOverflow中文版 from my HTML document. It seems that removing some tags simply doesn\'t work.

I'd like to strip certain elements开发者_StackOverflow中文版 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?


To remove all stylesheets, try this:

$('link[rel=stylesheet]').remove();
0

精彩评论

暂无评论...
验证码 换一张
取 消