如何使用jQuery删除样式属性下的width属性? [英] How to remove width attribute which is under style attribute using jQuery?

查看:681
本文介绍了如何使用jQuery删除样式属性下的width属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<div class="views" style="position: relative; width: 421px; height: 15px; overflow: hidden;">
TEST TEXT
</div>

如何使用jQuery删除样式属性下的width属性?

How to remove width attribute which is under style attribute using jQuery?

我知道removeAttr("width");

但由于宽度是样式属性的子元素,因此在这里不起作用

推荐答案

您可以使用:

.css('width', 'auto')

这篇关于如何使用jQuery删除样式属性下的width属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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