使用jQuery更改CSS样式 [英] Changing CSS style using jquery

查看:104
本文介绍了使用jQuery更改CSS样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试修改div的宽度.我在做什么错了?

I'm trying to modify the width of a div. What am I doing wrong?

$('#foo')

[<div class=​"bar" id=​"foo" style=​"width:​ 40%">​</div>​]

$('#foo').css('style','width:50%')

[<div class=​"bar" id=​"foo" style=​"width:​ 40%">​</div>​]

推荐答案

我认为应该

$('#foo').css('width','50%')

这篇关于使用jQuery更改CSS样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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