是否可以使用jQuery删除应用于HTML的任何样式,而不是通过CSS或样式属性,例如:
<table width="100%" border="0" cellSpacing="0" cellPadding="0">我想删除width,border,cellSpacing和cellPadding。
我在这里看过这篇文章: 使用jQuery删除内联样式但它只对特定属性执行此操作加上它似乎使用style属性应用它而不删除内联属性。
编辑:我不想删除使用style属性应用的任何内容我想要删除任何未使用它的任何内容谢谢
Is it possible using jQuery to remove any styles applied to an HTML not via CSS or the style attribute, for example here:
<table width="100%" border="0" cellSpacing="0" cellPadding="0">I'd like to remove width, border, cellSpacing & cellPadding.
I've seen this post here: Use jQuery to remove an inline style but it only does that for a specific attribute plus it seems to apply it using the style attribute and not remove inline ones.
EDIT: I don't want to remove anything that has been applied using the style attribute I want to remove anything that hasn't been applied using it Thanks
最满意答案
以前的答案正好说明了你不想要的东西。
不是通过CSS或style属性。 我想删除width,border,cellSpacing和cellPadding。
$('*').removeAttr('width border cellSpacing cellPadding'); // etcPrevious answers are stating exactly what you didn't want.
not via CSS or the style attribute. I'd like to remove width, border, cellSpacing & cellPadding.
$('*').removeAttr('width border cellSpacing cellPadding'); // etc更多推荐
发布评论