3
I used the following code in jQuery to mask the field telefone
for example.
jQuery(document).ready(function () {
$("#telefone").mask("(99)9999.9999");
});
This code works perfectly on the computer, but on the mobile, only appears the formatting waiting to be typed something, but when something is typed, the mask is not applied, thus mixing the numbers with the other characters.
Example of what happens:
jQuery(function($){
$("#telefone").mask("(99) 9999-9999");
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://raw.githubusercontent.com/digitalBush/jquery.maskedinput/1.4.1/dist/jquery.maskedinput.min.js"></script>
<strong>No desktop: </strong>
<input type="text" id="telefone">
<br><br>
<strong>No celular: </strong>
<input type="text" value="(__)____.____">
Does anyone have any idea how to fix this?
Note: If you enter the correct number amount from the phone, even if you have other characters in the field, it applies the filter by pressing enter, or clicking outside the field.
I’ve had this problem too - for me the solution was to use a mask in pure javascript.
– BrTkCa