5

So below is my snippet, currently inputmask allow only this format "_." (e.g 5.55). Is there a way I could extend the format like I want this format "._____________.." (e.g 55.555555555555555555555... where after 55. the rest of the input digits must be unlimited). Any ideas, help, clues, suggestions, recommendations please?

$(document).ready(function(){
  
  $('.decimal').inputmask({ mask: "*[.**]", greedy: false, definitions: { '*': { validator: "[0-9]" } } });
  
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://rawgit.com/RobinHerbots/jquery.inputmask/3.x/dist/jquery.inputmask.bundle.js"></script>

<input type="text" class="decimal form-control" />
Juliver Galleto
  • 8,831
  • 27
  • 86
  • 164

3 Answers3

4
$('.decimal').inputmask({ mask: "99.9{1,}"})

{1,} = minimum 1 , infinite for the preceding char , if you need it optional {0,}

greenseed
  • 509
  • 5
  • 10
0
Inputmask("*{n}").mask($(".text_only")); 

Here n stands for n number

Abel Jojo
  • 758
  • 3
  • 14
  • 30
  • thanks it works, I used it in alphanumeric mask like this : `$('.alphaNumeric_mask').inputmask('*{Z}',{ "placeholder": "", translation: {'Z': {pattern: /^[a-zA-Z0-9]+$/, recursive: false}}});` – AZIIZ Farhat Dec 10 '21 at 13:14
0

This doesn't exactly answer the question but in my case I wanted unlimited integers, so I used the expression:

9{0,}

Stephen Paul
  • 37,253
  • 15
  • 92
  • 74