标签:
1 //验证from表单 2 $(function () { 3 $("#addUserForm").validate({ 4 rules: { 5 txtName: { required: true, rangelength: [2, 10] }, 6 txtPwd: { required: true, rangelength: [2, 10] }, 7 txtRePwd:{equalTo:"#txtPwd"} 8 }, 9 messages: { 10 txtName: { required: "用户名不能为空", rangelength: "用户名长度必须为2-10位" }, 11 txtPwd: { required: "用户名不能为空", rangelength: "用户名长度必须为2-10位" }, 12 txtRePwd:{equalTo:"两次输入的密码不一样"} 13 } 14 }); 15 }); 16 17 //提交form表单 18 $(function () { 19 var options = { 20 beforeSubmit: function () { 21 alert("前"); 22 }, 23 success: function (data) { 24 alert("后"); 25 } 26 } 27 $("#pwdForm").ajaxForm(options); 28 });
标签:
原文地址:http://www.cnblogs.com/james641/p/4395317.html