4
My situation: I have an input masked that way: 0,0000 %
. However, to be able to validate as desired, I need to use a replace
, changing the comma by a point, removing the %
and then treating the value in this way: 0.0000
.
I know I can use something like numero.replace(",",".")
but it will only replace the comma with the dot, and my validation will continue to fail.
It is possible in one replace
or similar code, swap the characters and remove the %
?
Although the problem has already been solved, below is my answer to Sergio:
In my validation, I can have numbers only less than or equal to 100. As for the format (string or number), I can’t say with 100% certainty. I guess it’ll have to be number, because this value will probably be stored in a BD and as a string I think will not be very viable.
Detail: It is not recommended that I wear anything back-end for the time being. Only front-end. It is more a client side validation to not let the user send bizarre values in the post.
@Sergio’s here, buddy. Thanks!
– Victor Alencar Santos