相关疑难解决方法(0)

计算文字宽度

我正在尝试使用jQuery计算文本宽度.我不确定是什么,但我肯定做错了什么.

所以,这是代码:

var c = $('.calltoaction');

var cTxt = c.text();

var cWidth =  cTxt.outerWidth();

c.css('width' , cWidth);
Run Code Online (Sandbox Code Playgroud)

jquery

99
推荐指数
8
解决办法
11万
查看次数

自动缩放输入[type = text]到值的宽度?

有没有办法将a的宽度缩放<input type="text">到实际值的宽度?

input {
  display: block;
  margin: 20px;
  width: auto;
}
Run Code Online (Sandbox Code Playgroud)
<input type="text" value="I've had enough of these damn snakes, on this damn plane!" />

<input type="text" value="me too" />
Run Code Online (Sandbox Code Playgroud)

html css jquery

77
推荐指数
9
解决办法
14万
查看次数

标签 统计

jquery ×2

css ×1

html ×1