admin管理员组

文章数量:1401281

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, remendations please?

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

<input type="text" class="decimal form-control" />

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, remendations please?

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

<input type="text" class="decimal form-control" />

Share Improve this question asked Dec 1, 2015 at 1:36 Juliver GalletoJuliver Galleto 9,05727 gold badges92 silver badges168 bronze badges
Add a ment  | 

3 Answers 3

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

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

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

Here n stands for n number

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

9{0,}

本文标签: javascriptinputmask must allow unlimited digitsStack Overflow