所以,问题就在于主题的标题中。在Chrome中使用type="number"
和pattern="[0-9]*"
的输入正常工作,但在FF中允许字母。有没有不使用jQuery或JS的方法来解决它?
.small-input {
-moz-appearance: textfield;
}
.small-input::-webkit-inner-spin-button {
display: none;
}
.small-input::-webkit-outer-spin-button,
.small-input::-webkit-inner-spin-button {
-webkit-appearance: none;
margin: 0;
}
}
<input class="small-input " pattern="[0-9]*" value="" type="number">