Error: Cannot read property 'addMethod' using jQuery Validation
Error: Cannot read property 'addMethod' using jQuery Validation
No one was able to solve this on Stackoverflow..
https://stackoverflow.com/questions/54384682/using-only-one-jquery-validation-script-that-also-supports-addmethod
Error: Cannot read property 'addMethod....
https://forum.jquery.com/topic/validator-addmethod-not-recognized
**What is the ONE verision that supports both jQuery validation AND the addMethod?** It can be done like this fiddle
http://jsfiddle.net/ryleyb/cc9yxt2a/
Anyway, here is my "working" code (works except it does not detect only letters):
<script src="
https://code.jquery.com/jquery-3.3.1.js"></script>
<script src="
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/js/bootstrapvalidator.min.js"></script>
<!-- <script src="
https://cdnjs.cloudflare.com/ajax/libs/bootstrap-validator/0.4.5/js/bootstrapvalidator.min.js
-->
<link rel="stylesheet" href="
https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
</head>
<script>
$.validator.addMethod("lettersonly", function(value, element) {
var i = /^[A-Za-z]+$/;
return this.optional(element) || (i.test(value) > 0);
}, "Name is required");
$().ready(function() {
// validate signup form on keyup and submit
$('#contact_form').bootstrapValidator({
rules: {
first_name: {
lettersonly: true,
required: true,
minlength: 2
},
notEmpty: {
message: 'Please supply your first name'
},
ajax.microsoft.com/ajax/jquery.validate/1.7/… from stackoverflow.com/questions/2794162/… did not seem to work either
I am not interesting in using multiple versions with noConflict() as that gets very complex. I understand this exists.
[1]:
https://information-contact.000webhostapp.com/
[2]:
http://jsfiddle.net/andrewwhitaker/7xD2H/
[3]:
https://information-contact.000webhostapp.com/1.4.4.php
Topic Participants
scott.schmidt1989
jakecigar