原文地址: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","width:82px;top:8px;color:white!important");

 

posted on 2021-04-29 16:51  多年小白  阅读(1370)  评论(0编辑  收藏  举报