Good afternoon On my there is
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="{{ asset('bundles/reflorestasite/js/jquery.maskedinput.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('bundles/reflorestasite/js/validacoes.js') }}"></script>
<script type="text/javascript" src="{{ asset_url }}"></script>
And on "validacoes.js" file there is
$(document).ready(function(){
$(".cpf").mask("999.999.999-99");
$('.cpf').blur(function () {
var id=$(this).attr("id");
var val=$(this).val();
var pattern = new RegExp(/[0-9]{3}[\.]?[0-9]{3}[\.]?[0-9]{3}[-]?[0-9]{2}/);
if(val.match(pattern) == null){
$("#"+id+"_error").html("Digite um CPF válido");
}
});
});
I've already verifed at console and all javascript files are there. However i'm getting the error "Uncaught TypeError: $(...).mask is not a function"
Does anyone has a clue why symfony is not recognizing the maskedinput plugin?
Thankyou very much.
The React.js "Uncaught TypeError: X is not a function" occurs when we try to call a value that is not a function as a function, e.g. calling the props object instead of a function. To solve the error, console.log the value you are calling and make sure it is a function.
jQuery itself does not provide functionality for masking an input. You can use one of the plugins avaiable for it.
The "TypeError: map is not a function" occurs when we call the map () method on a value that is not an array. To solve the error, console.log the value you're calling the map () method on and make sure to only call map on valid arrays. Here is an example of how the error occurs. We called the Array.map () method on an object and got the error back.
Change this line from
$(document).ready(function(){
to
$(document).ready(function($){
I got this same error too, but in my case I forgot to import maskedinput.min.js
<script src="/js/jquery.maskedinput.min.js" type="text/javascript"></script>
And I was searching Google for a solution haha.
I solved my problem, I had to remove duplicate script connections
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.maskedinput-1.3.min.js"></script>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With