I have a form I am trying to validate. This is the html
<h2>Personal Details</h2>
<p>Please enter in some information about you.</p>
<div id="form-row">
<label>Name</label>
<input type="text" name="name" value="" id="name" required/>
</div>
<div id="form-row">
<label>Telephone</label>
<input type="text" name="telephone" value="" id="telephone" required/>
</div>
<div id="form-row">
<label>Email</label>
<input type="email" name="email" value="" id="email" required/>
</div>
I need to use some form of validation so I opted to use jQuery validation plugin called .validate. This is my script
$(document).ready(function($) {
//When the form is submitted do this...
$("#stripe-payment-form").submit(function(event) {
//Validation
// just for the demos, avoids form submit
$.validator.setDefaults({
debug: true,
success: "valid"
});
$( "#stripe-payment-form" ).validate({
rules: {
telephone: {
required: true,
digits: true
}
}
});
When the page loads the first time I get no errors and validation is working. However If input 'aaa' into the telephone input I get this error and no validation occurs:
TypeError: $.validator is undefined
Does anyone know why this is happening? I was following along the documentation on
divsI can see that but I don't see how they would affect the issue im having at present