0
I need you to receive only values with this format (20.00)
Solved
<!-- apenas números-->
<script>
function somenteNumeros(num) {
var er = /[^0-9.]/;
er.lastIndex = 0;
var campo = num;
if (er.test(campo.value)) {
campo.value = "";
}
}
</script>
<input class="form-control input-sm" onkeyup="somenteNumeros(this);" placeholder="valor" maxlength="5" type="text" ng-model="numero.valor" />
worked out, accepted with the value with virtual, plus accept letters too, have to avoid it? I appreciate your help
– Harry
More dai is your function logic. According to the function you passed if the value passes in the
test
then you clear the field. It’s like this, it’s not?– Jhonatan Simões
It is validating correctly, the problem is that give to write text too.
– Harry
solved! thanks, posted the code in the question
– Harry