Lee Firth
Lee Firth

Reputation: 27

jQuery Validate plugin, validate email address doesn't work

Since Dreamweaver has dropped Spry, I am looking for a simple alternative and am trialing the validate jQuery plugin. The problem I am having is that while the email validation doesn't work at all.

I have added the include files to the head:

<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/jquery.validate.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.11.1/additional-methods.min.js"></script>

This is the code from the fields:

<div class="pure-control-group">
  <label for="First_Name">First Name:</label>
  <input type="text" name="First_Name" id="First_Name" required />
</div>
<div class="pure-control-group">
  <label for="Last_Name">Last Name:</label>
  <input type="text" name="Last_Name" id="Last_Name" required />
</div>
<div class="pure-control-group">
  <label for="Email_Address">Email:</label>
  <input type="text" name="Email_Address" id="Email_Address" />
</div>

This is the validation code:

$("#form1").validate({
rules: {
  Email_Address: {
  required: true,
  email: true
  }
    }
});

Pretty simple. The first two fields validate correctly but not the email field.

Upvotes: 2

Views: 586

Answers (1)

Mark
Mark

Reputation: 23

can you ensure you have the ID attached to your opening form tag?

ie: form id="form1"?

ahh just noticed you said the others do validate.

Upvotes: 1

Related Questions