jQuery validate keeps getting a TypeError

33 views Asked by At

I'm implementing form validation in a Wordpress site using jQuery validate. I implemented this a bunch of time, but this time I can't get it to work. I include scripts in my <head> section like this:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script src="<?=get_template_directory_uri() . '/js/custom.js'?>"></script>

This is the right way to do it, right? First I'm including the jQuery library, then jQuery validate and finally I add my custom javascript where I call the validate method. This is the code I use for that:

$(document).ready( function() {

    if($('#get-email').length > 0)
    {
        $('#get-email').validate();
    }

});

I don't see anything going wrong up to this point. But still I can't seem to get rid of a TypeError:

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

Does anyone know where this could be going wrong?

Keep in mind:

  • This is a wordpress site
  • I'm using bootstrap CSS and JS
0

There are 0 answers