My situation : I have a masked input like this: 0,0000 %
. However, to be able to validate as a wish, I need to use a replace
, changing the comma by point, removing the %
and then treating the value this way: 0.0000
.
I know I can use something like numero.replace(",",".")
but this will only change the comma by the point, and my validation will continue to fail.
Is it possible in a single replace
or similar code, change the characters and remove %
?
Although the problem has already been solved, here is my answer to Sergio :
In my validation, I can have numbers only less than or equal to 100. Regarding the format (string or number), I can not say with 100% certainty. I think it will have to be number , as this value will probably be stored in a DB and as a string I think it will not be very viable.
Detail : I do not recommend that I use anything back-end for now. Only front-end . It's more a client side validation not to let the user send bizarre values in the post.