Итак, я создаю контактную форму, и я пытаюсь создать скрипт проверки, и он не работает вообще, он даже не показывает ошибок. Он просто переходит к проверке по умолчанию.Скрипт проверки jQuery не работает вообще
Я просмотрел ресурсы, и файл JS загружен на страницу, но просто не работает ...?
jQuery.validator.addMethod("answercheck", function(e, t) {
return this.optional(t) || /^\bcat\b$/.test(e)
}, "Please type the correct answer"), $(function() {
$("#contact").validate({
rules: {
name: {
required: !0,
minlength: 2
},
email: {
required: !0,
email: !0
},
message: {
required: !0
},
answer: {
required: !0,
answercheck: !0
}
},
messages: {
name: {
required: "Please enter a name",
minlength: "Your name must consist of at least 2 characters"
},
email: {
required: "Please enter an email"
},
message: {
required: "Please enter a message",
minlength: "Please enter a longer message"
},
answer: {
required: "Incorrect"
}
},
submitHandler: function(form) {
$(form).ajaxSubmit({
type:"POST",
data: $(form).serialize(),
url:"process.php",
success: function() {
$('#contact :input').attr('disabled', 'disabled');
$('#contact').fadeTo("slow", 0.15, function() {
$(this).find(':input').attr('disabled', 'disabled');
$(this).find('label').css('cursor','default');
$('#success').fadeIn();
});
},
error: function() {
$('#contact').fadeTo("slow", 0.15, function() {
$('#error').fadeIn();
});
}
});
}
});
});
вы можете предоставить скрипку? – Unlockedluca
http://jsfiddle.net/arunpjohny/xmj590nj/1/? –
Хорошо, поэтому по какой-то причине jsFidddle работает, но не [веб-страница] (http://webyo.com.au/contact-us.html) – Tate