如何从Html.TextBoxFor中删除选择器?
问题描述:
我有一个Html.TextBoxFor的小问题。我需要的是删除选择器。如何从Html.TextBoxFor中删除选择器?
@Html.TextBoxFor(m => m.StartFund.Funds, new { id = "startFundsTextBox", @class = "k-textbox", @style = "width:20%; display:inline-block", @type = "number", @min = "0" })
任何线索?
答
使用css
您可以从输入类型编号中删除旋钮。
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
-webkit-appearance: none;
margin: 0;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input type='number' />
答
卸下@type="number"
属性(因此也@min
因为它是现在无关):
@Html.TextBoxFor(m => m.StartFund.Funds, new { id = "startFundsTextBox", @class = "k-textbox", @style = "width:20%; display:inline-block" })
这使得正常的文本框,而不是一个数字输入。
+0
THX为ü回答,但我想和@类型=“数字”,只有删除选择。 – fleja
就是这样!非常感谢你:) – fleja
很高兴帮助.Up投票并接受答案。快乐的编码。 :) –