How can you mask in a phone input only to accept numbers and already enter the formatting (xx) xxxxx-xxxx
How can you mask in a phone input only to accept numbers and already enter the formatting (xx) xxxxx-xxxx
I learned on this site even, to use this instance, as follows:
$("#telefone, #celular").mask("(00) 0000-0000");
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.11/jquery.mask.min.js"></script>
<label>Telefone</label>
<input type="text" class="form-control" placeholder="Telefone" id="telefone" name="telefone" ><br>
<label>Celular</label>
<input type="text" class="form-control" placeholder="Celular" id="celular" name="celular" ><br>
Using jQuery, you can do as follows:
$('#id_do_campo').mask('(99) 99999-9999');