Mask accepting letters and numbers

Asked

Viewed 1,027 times

0

I wear a mask Jquery thus, but fills only numbers:

$("#FormaCalculosVencimentos").mask("000,000,000");

The need arose to type letters and numbers only in the first item, of each comma, would look like this T15 or 015, it is possible to type both letter and numbers, but only in the first.

Example:

T15,020,T20

I do not know if it was clear, I saw that in some documents accepted the * or ? for letter and numbers, but it didn’t work. Which character is left as letter and number?

The user has no limit, he can write as much as he prefers, but always the first, can be letter or number, and the rest only numbers.

Thus:

T05,025,032,T58 etc
  • me a complete example of numbers that will enter. by the Mask that Voce ta using is required the user to write 999,999,999, the 9 numbers. would be just that ?

  • present a [MCVE]

  • I edited the answer, explaining it a little better, he can type as many characters as he wants.

  • @marianac_costa the user could type as much B12, B33, J11 as B12, B33, J11, H11, J22, K78, ... would be this?

1 answer

2


You can indicate to which position you can receive a letter using the A

$("#FormaCalculosVencimentos").mask("A00,A00,A00");
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.min.js"></script>
<input id="FormaCalculosVencimentos" type="text" />

Browser other questions tagged

You are not signed in. Login or sign up in order to post.