<div><a id="link" style="position:fixed !important;
bottom:0px !important;
right:0px !important;
color:#000000 !important;font:10pt Arial !important">press me</a>
</div>
为了把那个div block 改成
<div><a id="link" style="position:fixed !important;
bottom:0px !important;
left:100px !important;
color:#000 !important;font:10pt Arial !important">press me</a>
</div>
(只有左边的属性不同),我试试这个
- 移除样式的所有属性
($'#link').RemoveAttr('style');
- 我想重新添加 style 的属性,但似乎不存在这样的 AddAttr。
最佳答案
你可以使用 .attr('style', '') 删除,和 .attr('style', '...');将样式设置回来。
但是将 css 样式设置为两个不同的类并改用 .addClass() 和 .removeClass() 可能会更好。
关于javascript - 删除样式的所有属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13393526/