我需要此输入的一些帮助,因为我希望它只接受 2 个小数和逗号或点,但现在只允许逗号而不是点和任何小数。我对 RegExp 非常陌生,我正在尝试这个。
<td>
<input type="number" ng-model="material.porcentaje" ng-change="calculaKilos(material, $index);validatePorcentaje($index)" id="porcentaje" class="input_small-stretch" ng-pattern="/^[0-9]+(\.[0-9]{1,2})?$/">
</td>
最佳答案
查看 RegExr帮助构建您的正则表达式模式。我可以尝试为您构建模式,但没有示例文本很难。
关于javascript - 接受带逗号和点的小数 (html),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54524217/