如何用jQuery替换css选择器?

Abu*_*zzy 0 javascript jquery

我想将height属性替换为min-height

这就是我通常会更改值的方法,但不确定如何更改属性

 $('.mySelector').css('height','650px')

<div class="mySelector" style="cursor: -moz-grab; width: 1266px; height: 650px;">
Run Code Online (Sandbox Code Playgroud)

我的道歉应该早些提到这一点

Mar*_*.io 6

如果您在height属性中设置了高度,我认为您必须执行以下操作:

var selector = $('.mySelector');

// set the min-height to I guess whatever the height you had set was
selector.css('min-height', selector.attr('height'));

// remove that old height attribute
selector.removeAttr('height');
Run Code Online (Sandbox Code Playgroud)