How to apply !important using .css()?

后端 未结 30 3066
情深已故
情深已故 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:30

    If it is not so relevant and since you're dealing with one element which is #elem, you can change its id to something else and style it as you wish...

    $('#elem').attr('id', 'cheaterId');
    

    And in your CSS:

    #cheaterId { width: 100px;}
    

提交回复
热议问题