[英]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>
我試圖通過將最小值設置為1 bt來限制它不起作用,有人可以幫忙嗎?
您可以使用input type="number
<input type="number" value="1" min="1">
使用此功能也不需要自己創建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">
如果要限制輸入文本字段的數量,可以給它“ maxlength”。 maxlength限制您可以在其中鍵入的最大文本數。
<input type="text" value="1" maxlength="1">
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.