获取没有css或width属性的元素宽度 [英] Get width of element with no css or width attribute

查看:142
本文介绍了获取没有css或width属性的元素宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:您有一个带有一些文本的div,这个div没有css宽度,没有jquery宽度,没有宽度属性分配给它以任何方式。但是它有一个宽度,由于内部的内容,这是未定义的,报告为null在jQuery。我的问题是:有没有办法退出这个div的宽度。

Scenario: You have a div with some text, this div has no css width, no jquery width, no width attribute assigned to it in any way. However it has a width due to the content that is inside it, this is undefined, reports as "null" in jQuery. My question is: is there any way to retireve the width of this div?

推荐答案

>

with jquery you can do below

$('#id').width()

这篇关于获取没有css或width属性的元素宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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