My script throw errors:
TypeError: jQuery.validator is undefined additional-methods.js:20 TypeError: $(...).validate is not a function index.php:115
You didn't include the base jQuery Validation library:
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js"></script>
Put that before the additional methods library. (BTW this is a hosted version, download your own if you want)
You're not loading the validation plugin. You need:
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
Put this before the line that loads the additional methods.
Also, you should get the additional methods from the CDN as well, rather than jquery.bassistance.de.
Other errors:
[4.20]
should be
[4,20]
and
rangelenght:
should be:
rangelength:
Include jquery.validate.js before additional-methods.js
.
$.validate()
method is defined there
I had the same problem. I am using jquery-validation as an npm module and the fix for me was to require the module at the start of my js file:
require('jquery-validation');
If using VueJS, import all the js dependencies for jQuery extensions first, then import $ second...
import "../assets/js/jquery-2.2.3.min.js"
import "../assets/js/jquery-ui-1.12.1.min.js"
import "../assets/js/jquery.validate.min.js"
import $ from "jquery";
You then need to use jquery from a javascript function called from a custom wrapper defined globally in the VueJS prototype method.
This safeguards use of jQuery and jQuery UI from fighting with VueJS.
Vue.prototype.$fValidateTag = function( sTag, rRules )
{
return ValidateTag( sTag, rRules );
};
function ValidateTag( sTag, rRules )
{
Var rTagT = $( sTag );
return rParentTag.validate( sTag, rRules );
}
For me problem solved by changing http://ajax... into https://ajax... (add an S to http)
https://ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.js