Input retains two decimal places, exceeding the hidden

value = value.replace (/ ^ (-) (d +). (dd). $/,"$1decimal 2.decimal 3"); / / you can only enter two decimals
so you can"t enter a negative value. What"s going on?

Mar.07,2021

value = value.replace(/^(-)?(\d+)\.(\d\d).*$/,'$1$2.$3');

try this as above


you can use toFixed, but you need to convert it to Number type


Number . There is no replace method. You only support String type: value.toString (). Replace (/ ^ (-)? (\ d +)\ (\ d\ d) (. *) $/,'$1room2.03') .

.
Menu