0
I am developing an area where the student will register in it, so I decided to seek help from libraries like jQuery, I got a good result before that, but there are some errors in my script that I cannot identify.
<!Doctype html>
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.js"></script>
</head>
<body>
<form name="dados" id="dados" method="POST">
<input type="text" id="cpf" name="cpf" placeholder="CPF">
<input type="text" id="telefone" name="telefone" placeholder="Telefone">
<input type="text" id="celular" name="celular" placeholder="Celular">
</form>
</body>
<script>
$(document).ready(function(){
$('#cep').mask('00000-000');
$('#telefone').mask('0000-0000');
$('#celular').mask('00000-0000');
$('#cpf').mask('000.000.000-00', {reverse: true});
$('#rg').mask('00.000.000-00', {reverse: true});
});
</script>
This jQuery Mask is developed by: https://igorescobar.github.io/jQuery-Mask-Plugin/docs.html
NOTE: My script does not work applying previously mentioned masks.
You need to add jquery to the head as well, not just the input Masked plugin.
– Máttheus Spoo
I just added <script src="jquery-3.3.1.min. js"></script> but it doesn’t work.
– King
Just to make clear the jQuer link should come first that the plugin link you know right? type like: <script src="jquery-3.3.1.min. js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.mask/1.14.15/jquery.mask.js"></script>
– hugocsl
Yes, I did so.
– King
try to insert via Cdn the jquery.
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
– Máttheus Spoo
I appreciate the help, but still not running my script... I do not know what is wrong honestly.
– King
Always when working with Javascript leave the browser console open. Press F12 if using the Chrome and see if there are any errors in the tab console.
– LeAndrade