Regular validation failed when ios entered the amount of decimal point?

I have a regular: var tamp = / ^ (1-9 {0jue 7} | 0) (. [d] {1Jue 2})? $/; there is an oninput input box event in input that verifies that the characters entered are correct, normal on android and normal on chrome, but on ios, enter "0." When it does not conform to the tamp rule, the same decimal point, why is it normal on android and chrome, but an error will be reported on ios? Find the solution

Feb.28,2021

is like this. In the case of < input type= "number" > on Android and chrome, entering 0. will record this value as 0 , while iOS, will record this value as 0. . Since what you match later is \. [\ d] {1 code 2} , you must follow the number after the decimal point, resulting in an unsuccessful iOS match and an error.
in addition, in the case of type= "number" , the maxlength attribute does not take effect.


now my verification method is not to listen to the oninput event of the input box in real time, but to verify the format of the user input after the user input is completed. Although it can be used, I am very depressed that the test girl gets into trouble every time with an input character such as "0.00-" (even though this kind of illegal input will not pass the verification when it is finally submitted). Who has a better way, or a better way to verify it? Please give me some advice

Menu