jquery css 添加 !important 样式无效

原文地址:https://blog.csdn.net/yan263364/article/details/82184773

要用jquery中css方法覆盖css样式中的color: #998!important的样式,但是没起效 ,发现在用css方法添加 !important 时,需要用特殊的写法。

错误写法:
$('#box').css({"width":"82px", "top":"8px", "color":"#fff!important"});
正确写法:
$("#box").css("cssText","82px;top:8px;color:white!important");
原文地址:https://www.cnblogs.com/xi-li/p/14718658.html