I am having trouble applying a style that is !important
.
(我在应用!important
样式时遇到麻烦。)
(我试过了:)
$("#elem").css("width", "100px !important");
This does nothing ;
(这什么都不做 ;)
no width style whatsoever is applied.(不会应用任何宽度样式。)
Is there a jQuery-ish way of applying such a style without having to overwritecssText
(which would mean I'd need to parse it first, etc.)? (有没有一种类似jQuery的方式来应用这种样式,而不必覆盖cssText
(这意味着我首先需要解析它,等等)?)
Edit : I should add that I have a stylesheet with an !important
style that I am trying to override with an !important
style inline, so using .width()
and the like does not work since it gets overridden by my external !important
style.
(编辑 :我应该补充一点,我有一个样式表,具有!important
样式,我试图用!important
样式内联重写,所以使用.width()
之类的方法不起作用,因为它被我的外部!important
样式覆盖。)
Also, the value that will override the previous value is computed , so I cannot simply create another external style.
(此外,将覆盖以前的值的值的计算 ,所以我不能简单地创建另一个外部风格。)
ask by mkoryak translate from so