jquery更改div类的style属性 [英] jquery to change style attribute of a div class

查看:1147
本文介绍了jquery更改div类的style属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似这样的滑块类,我要改变样式属性 style =left:336px

I have a slider class like this and I wan to change the style attribute style="left: 336px"

<div id="range-cont">
<div class="slider">
<div class="progress" style="width: 350px;"></div>
    <a class="handle" href="#" **style="left: 336px;"**></a>
</div>
<input id="percentage" class="range" type="range" value="14" name="percentage" min="0" max="100">
<p id="percent-label">%</p>
</div>
</div>

我尝试了
$('。handle')。css ({'style':'left:300px'})但它不工作。
不确定我在这里做什么错误

I tried $('.handle').css({'style':'left: 300px'}) but its not working. Not sure what I am doing wrong here

推荐答案

只需尝试 $ ').css('left','300px');

这篇关于jquery更改div类的style属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆