How to apply !important using .css()?

后端 未结 30 2983
情深已故
情深已故 2020-11-21 07:06

I am having trouble applying a style that is !important. I’ve tried:

$(\"#elem\").css(\"width\", \"100px          


        
30条回答
  •  终归单人心
    2020-11-21 07:25

    I think it works OK and can overwrite any other CSS before (this: DOM element):

    this.setAttribute('style', 'padding:2px !important');
    

提交回复
热议问题