Uncaught TypeError: $ (...) .validate is not a function

1

I am using jquery validate and it was working normally, now it is returning the following error, I checked the references, I changed, but it continues 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><linkrel="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><scriptsrc="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 way I refer to, the same error remains.

Here's 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><scriptsrc="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><scriptsrc="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.0/additional-methods.js"></script>
    
    <script src="/javascript/validacao.js"></script>

All changes I make, no back to work the validate.

    
asked by anonymous 18.04.2018 / 14:46

1 answer

0

There is a failure in the path set for the file .js of jQuery , so this error is being presented, perhaps the path to the file has been incompletely placed and the browser can not find the file.

If you add an external import of the file jquery.min.js as I did in the first line of the code below, the error is no longer displayed:

$(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');
    }
  });

});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scripttype="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><linkrel="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><scriptsrc="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.js"></script>
    
18.04.2018 / 14:49