重置jQuery(仅)设置的内联css
我有(请不要反驳原因)以下html重置jQuery(仅)设置的内联css,jquery,html,css,Jquery,Html,Css,我有(请不要反驳原因)以下html <div class="something" style="background: green;"></div> 这让我在inspector中留下了以下标记 <div class="something" style="background: green; position: fixed"></div> 不幸的是,我不能在样式-属性
<div class="something" style="background: green;"></div>
这让我在inspector中留下了以下标记
<div class="something" style="background: green; position: fixed"></div>
不幸的是,我不能在样式
-属性中设置位置
-属性。它覆盖了我的css,比如一些类的改变等等
我想要的是:
我现在正在寻找一种方法来删除jQuery放在那里的样式
-属性的部分。。。类似于$(.something”).css(“位置”,未设置)代码>
请不要!重要提示
对我的css的建议!
我更多的是寻找一种干净的方法来解决这个问题,而不是解决我在这里遇到的特定问题如果你想删除一个特定的CSS样式属性,你可以使用函数并将其设置为空字符串来删除它:
// This will set the position attribute back to its original value
$('.something').css('position','');
找出它在你的班级变化中应该处于什么样的位置,并将其改变为那个位置?我向你发誓,我已经尝试过了;它对我不起作用——但现在起作用了!现在网络上至少有证据了。我找不到s!不要在网上谈论它。那么有什么更好的标题的建议吗?[再次编辑]Stack刚刚告诉我这个问题已经得到了回答-我质疑我的google技能z:X
<div class="something" style="background: green; position: static"></div>
// This will set the position attribute back to its original value
$('.something').css('position','');