[英]How to limit the number below the 1 in text input field
<div class="numeric-input">
<input type="text" value="1" min="1">
<span class="arrow-up"><i class="icons icon-up-dir"></i></span>
<span class="arrow-down"><i class="icons icon-down-dir"></i></span>
</div>
I try to limit this by placing the min value 1 bt it does not work.Can anybody help? 我试图通过将最小值设置为1 bt来限制它不起作用,有人可以帮忙吗?
You can use input type="number
您可以使用
input type="number
<input type="number" value="1" min="1">
Using this also doesn't need to create up and down arrows
yourself to increase
and decrease
value. 使用此功能也不需要自己创建
up and down arrows
即可increase
或decrease
值。
您已经使用输入type =“ text”更改为
<input type="number" value="1" min="1">
在输入字段中使用min =“ 1” attr
使用type =“ number”
<input type="number" value="1" min="1">
If you want to limit the number of input text field, you can give "maxlength" to it. 如果要限制输入文本字段的数量,可以给它“ maxlength”。 maxlength limit the maximum number of text you can type inside of it.
maxlength限制您可以在其中键入的最大文本数。
<input type="text" value="1" maxlength="1">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.