用jQuery验证 [英] Validating with jQuery
本文介绍了用jQuery验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在这里待了一天,但我无法正常工作.
如何使用jquery.validate插件(触发但没有任何反应)验证页面上的控件,同时,如果表单无效,如何阻止服务器端方法触发?
我的validation.js:
I''ve been at this for a day now, and I can''t get it to work.
How would you validate the controls on the page with the jquery.validate plugin (its firing but nothing is happening), and at the same time, how would I block the server side method from firing if the form is not valid?
my validation.js:
$(document).ready(function() {
$("#Form1").validate();
$('#nationalSociety').rules('add', {
required: true,
messages: {
required: 'National Society cannot be empty'
}
});
$('#participantName').rules('add', {
required: true,
messages: {
required: 'Participant Name cannot be empty'
}
});
});
推荐答案
(文档).ready(
(document).ready(function() {
( # Form1").validate();
("#Form1").validate();
(# nationalSociety').rules(' add',{ 必需: true , 讯息:{ 必需:' 国家红会不能为空' } });
('#nationalSociety').rules('add', { required: true, messages: { required: 'National Society cannot be empty' } });
这篇关于用jQuery验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文