inputmask numeric with two decimal places

Juliver Galleto picture Juliver Galleto · Nov 27, 2015 · Viewed 7.2k times · Source

I'm trying to transform my normal input field unto a numeric input with two decimal places using the great plugin called "inputmask" by awesome "RobinHerbots", below snippet is what I tried but sadly and unfortunately its not working, any ideas, help please?

Answer

greenseed picture greenseed · Jan 25, 2017
$('.decimal').inputmask({ mask: "99.99"}) // As you requested

OR

$('.decimal').inputmask({ mask: "99.9{2}"}) //Same as the first one, {2} mean preceding char count MUST be 2

OR

$('.decimal').inputmask({ mask: "(99)|(99.9{1,2})"}) //We use optional here so user can enter 99 or 99.9 or 99.99