【发布时间】:2014-06-24 04:04:52
【问题描述】:
我正在尝试更改文本区域的高度。 Zurb 的基金会已经定义了5rem !important 的高度。
现在,当我尝试使用 jQuery 更改我的高度时,它并没有改变。我试过了:
$('textarea').height('500px')
$('textarea').css('height', '500px', 'important);
没有任何效果。任何其他属性的 CSS 都会随着 .css() 而改变。我能做什么?
【问题讨论】:
-
已经定义的样式
5rem !important是内联样式吗? -
没有发现问题:jsfiddle.net/U75uW 你能检查一下其他样式定义是否覆盖了你的 jQuery 样式
-
@blunderboy,不,它是在基金会的 css 文件中定义的。
-
.css('height', '500px', '!important');- 重要中缺少引号 -
@ShaunakD,不,当您使用 jQuery 时,您不需要
!:.css(name, value, priority)。
标签: javascript jquery