如何使用jquery修改css中帶有!important的樣式屬性

字號:


    如何使用jquery修改css中帶有!important的樣式屬性?下面小編就為大家?guī)硪黄褂胘query修改css中帶有!important的樣式屬性方法。希望對大家有所幫助。一起跟隨小編過來看看吧
    <div>使用jquery修改css中帶有!important的樣式屬性</div>
    外部樣式為:
    div.test{
      width:auto !important;
      overflow:auto !important
    }
    通過 $("div.test").css("width","100px");和 $("div.test").css("width","100px !important");是無效的
    要想修改div的width,可以通過如下這種方式:
    $("div.test").css("cssText", "width:650px !important;");要想修改多個屬性,可以這么做:
    $("div.test").css("cssText", "width:650px !important;overflow:hidden !important");
    以上這篇如何使用jquery修改css中帶有!important的樣式屬性就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考