Juliver Galleto
Juliver Galleto

Reputation: 9047

inputmask must allow unlimited digits

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" />

Upvotes: 5

Views: 5678

Answers (3)

Stephen Paul
Stephen Paul

Reputation: 39025

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

9{0,}

Upvotes: 0

greenseed
greenseed

Reputation: 529

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

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

Upvotes: 4

Abel Jojo
Abel Jojo

Reputation: 758

Inputmask("*{n}").mask($(".text_only")); 

Here n stands for n number

Upvotes: 0

Related Questions