1
I am using jquery validate and it was working normally, now it is returning me the following error, I already checked the references, I changed, but still with the same problem:
Uncaught Typeerror: $(...). validate is not a Function
<script type="text/javascript" src="/javascript/jquery-3.1.1.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/mobile/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/mobile/bootstrap-theme.min.css" />
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/style2.css" />
<link rel="shortcut icon" href="/images/iconepagina.ico">
<script src="/javascript/validacao.js"></script>
<link rel="stylesheet" href="/css/mobile/validacao.css" />
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js"></script>
And here is my validation.js
$(document).ready(function() {
$('#contact-form').validate({
rules: {
txtNome: {
minlength: 2,
required: true
}
},
highlight: function(element) {
$(element).closest('.control-group').removeClass('success').addClass('error');
},
success: function(element) {
element.text('OK!').addClass('valid')
.closest('.control-group').removeClass('error').addClass('success');
}
});
});
Every form I refer to, remains the same error.
Follows how the console error is:
jquery_master.min.js:3 Uncaught Typeerror: $(...). validate is not a Function At Htmldocument. (validation.js:44) at j (jquery_master.min.js:3) at k (jquery_master.min.js:3)
And here’s how the references are now:
<script type="text/javascript" src="/javascript/jquery-3.1.1.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="/css/mobile/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/mobile/bootstrap-theme.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/style2.css" />
<link rel="shortcut icon" href="/images/iconepagina.ico">
<script src="/javascript/jquery_master.min.js"></script>
<link rel="stylesheet" href="/css/mobile/validacao.css" />
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.js"></script>
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/additional-methods.js"></script>
<script src="/javascript/validacao.js"></script>
Every change I make, no return to validate.
In fact the error still persists, it informs the same problem, even adding the line you reported.
– Mariana
@marianac_costa You put the line in question before everything and inside the
tag head
of your page?– Leandro
I did, just like you helped me, but the same problem continues.
– Mariana
Try taking all references to . js or . css, just leave the reference pro jquery and pro validate, see if the problem persists after that.
– Leandro Lima
It still persists @Leandrolima, it was working perfectly, I believe the problem is right in the reference, but I can’t get back making it work.
– Mariana