Problem with mask on form

3

I'm using the Masked Input Digitalbrush plugin to format my phone field in the form, so I tried this did not work, can anyone help me?

<head>  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script><scripttype="text/javascript" src="assets/mascara.js"></script>
</head>

And no <body> :

<script type="text/javascript">
    jQuery(function($){
    $("#fone").mask("(99) 9999-9999");
    });
</script>

<div class="col-lg-6 col-sm-6 ">
<form id="form" method="post" action="mail/phpmailer.php">
    <input type="text" class="form-control" placeholder="Nome completo:" name="nome">
    <input type="text" class="form-control" placeholder="E-mail:" name="email">
    <input type="text" class="form-control" placeholder="Número para contato:" name="fone" id="fone">
    <textarea rows="6" class="form-control" placeholder="Digite sua mensagem" name="msg"></textarea>
    <button class="btn btn-success" id="enviar">Enviar</button>
</form>
</div>
    
asked by anonymous 16.06.2016 / 21:23

1 answer

2

Use Zero first

$("#fone").mask("(00) 0000-0000");

Or put jquery in the head and then use

$(document).ready(function() {
   $("#fone").mask("(99) 9999-9999");
}
    
16.06.2016 / 21:25