jquery修改css中带有!important的样式属性

xiaoxiao2021-02-28  69

[html]  view plain  copy <div class="test">使用jquery修改css中带有!important的样式属性</div>  

外部样式为

[css]  view plain  copy div.test{       width:auto !important;       overflow:auto !important   }   通过$("div.test").css("width","100px");和 $("div.test").css("width","100px !important");是无效的; 要想修改,可通过如下方式:

[javascript]  view plain  copy $("div.test").css("cssText""width:650px !important;");   要想修改多个属性,可通过如下方式:

[javascript]  view plain  copy $("div.test").css("cssText""width:650px !important;overflow:hidden !important"); 
转载请注明原文地址: https://www.6miu.com/read-54492.html

最新回复(0)