How to override css containing '!important' using jquery?

前端 未结 15 656
清歌不尽
清歌不尽 2020-12-29 21:05

I want to apply height for specific div using jquery but not able to override the \'!important\' keyword using jquery.

Here is

15条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 21:17

    You can do this:

    $(".myclass").css("cssText", "height: 0 !important;");
    

    Using "cssText" as the property name and whatever you want added to the css as it's value.

提交回复
热议问题