gpt4 book ai didi

javascript - 如何使用 jQuery 获取在 css 中设置的宽度值

转载 作者:行者123 更新时间:2023-11-28 18:19:40 24 4
gpt4 key购买 nike

在多次尝试使用 width()outerWidth()css("width) 之后,我发现所有这些方法都返回一个计算值(在我的例子中总是与原始值不同),那么我如何读取我在我的 css 中为元素 width 设置的值?

最佳答案

尝试 OuterWidth

$('#target').outerWidth(true);

the padding and border are included in the calculation; if you pass true, the margin is also included.

关于javascript - 如何使用 jQuery 获取在 css 中设置的宽度值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17277352/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com