The fact that you're using an id as your selector might be causing the issue. Instead of $('#form')
try to use $('.form-inline')
(the class all your forms seem to be sharing)
EDIT:
Ok so I looked pretty deep into it and here is what you should so.
$(document).ready(function()
{
$('.form-inline').each(function () {
$(this).validate(
{
errorPlacement: function(error, element)
{
element.parent("form").next("div.p").html(error);
}
});
$(this).children("input[type=email]").rules("add", {
required: true,
email: true
});
});
});
I think you should be careful with your naming convention though. Like try to call your error containers something more meaningful like "error-console"
See how instead of calling .validate()
on one specific element, you have to iterate through all of them using a .each()
loop.
Also, jQuery Validator use the name
attribute as a convention when declaring rule...so if you want to use a class you need to call that .rules("add", {})
in order to make it work
I hope this helped :)
ADDITIONAL EDIT:
Noticed your last form doesn't get validated .. it's because you have your last button set as type="button"
instead of type="submit"