【发布时间】:2014-10-06 10:40:00
【问题描述】:
我正在使用以下代码根据文本更改文本框宽度 并且当前它对于输入类型的工作正常
$(document).ready(function () {
$('.myclass').css('width', (($('.myclass').val().length)+1) * 6 + 'px');
});
这是正在工作的输入类型
<input type="text" class="myclass" disabled="disabled" style="margin-right: 5px;">
但是对于下面的代码它不起作用,知道吗?
@Html.TextBoxFor(model => model.Service, new { disabled = "disabled", @class = "myclass"})
【问题讨论】:
-
Html.TextBoxFor生成的 HTML 是什么? -
什么不起作用?如果宽度设置不正确?
-
@RGraham-这是 html
-
@StephenMuecke-宽度没有像在输入字段中那样一致地变化......
-
@Exception,尝试添加另一个文本框,你会发现它不起作用
标签: javascript css asp.net asp.net-mvc asp.net-mvc-5