
JQuery验证码控件怎么用
JQuery.idcode.js这个控件怎么用呀请帮忙讲详细点我试着用$("idCode").setCode();和$.idCode.setCode();都报错以前有个人...
JQuery.idcode.js 这个控件怎么用呀
请帮忙讲详细点
我试着用$("idCode").setCode();和$.idCode.setCode();都 报错
以前 有个人问过 我看了 不要再那么回答了 我不懂
都说了不要一楼这样的答案 百度上有的我自己不会搜吗
http://zhidao.baidu.com/question/100073206.html 展开
请帮忙讲详细点
我试着用$("idCode").setCode();和$.idCode.setCode();都 报错
以前 有个人问过 我看了 不要再那么回答了 我不懂
都说了不要一楼这样的答案 百度上有的我自己不会搜吗
http://zhidao.baidu.com/question/100073206.html 展开
2个回答
展开全部
1、功能
简单实现客户端信息验证,过滤不符合要求的信息
2、jquery.validate使用方法
a.引用js
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.validate.js"></script>
b.引用css
.error{
color:red;
margin-left:8px;
}
c.使用控件
$(document).ready(function() {
// validate signup form on keyup and submit
var validator = $("#signupform").validate({
rules: {
firstname: "required",
username: {
required: true,
minlength: 2
},
password: {
required: true,
minlength: 5
},
password_confirm: {
required: true,
minlength: 5,
equalTo: "#password"
},
email: {
required: true,
email: true,
},
dateformat: "required",
terms: "required"
},
messages: {
firstname: "姓名不能为空",
username: {
required: "用户名不能为空",
minlength: jQuery.format("用户名只少由 {0} 字符组成")
},
password: {
required: "密码不能为空",
minlength: jQuery.format("密码只少由 {0} 字符组成")
},
password_confirm: {
required: "确认密码不能为空",
minlength: jQuery.format("确认密码只少由 {0} 字符组成"),
equalTo: "秘密与确认密码不一致"
},
email: {
required: "邮箱不能为空",
email: "邮箱格式不正确"
},
dateformat: "请选择性别",
terms: " "
},
// the errorPlacement has to take the table layout into account
errorPlacement: function(error, element) {
if ( element.is(":radio") )
error.appendTo( element.parent().next().next());
else if ( element.is(":checkbox") )
error.appendTo ( element.next());
else
error.appendTo( element.parent().next());
},
// specifying a submitHandler prevents the default submit, good for the demo
submitHandler: function() {
alert("submitted!");
},
// set this class to error-labels to indicate valid fields
success: function(label) {
// set as text for IE
label.html(" ").addClass("checked");
},
highlight: function(element, errorClass) {
$(element).parent().next().find("." + errorClass).removeClass("checked");
}
});
});

2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
展开全部
* @example: $.idcode.setCode();
* @desc: Make a validate code append to the element that id is idcode.
将验证码附加到 id 为 idcode 的元素里去
*
* @example $.idcode.validateCode();
* @desc return true if user input value equal idcode.
如果用户输入的值等于验证码,返回true
具体的自已进行实验,还有看 jquery.idcode.js 里的内容,比较精短,还是能看懂它是怎么实现的
引自 --- sam_yy_cn -
* @desc: Make a validate code append to the element that id is idcode.
将验证码附加到 id 为 idcode 的元素里去
*
* @example $.idcode.validateCode();
* @desc return true if user input value equal idcode.
如果用户输入的值等于验证码,返回true
具体的自已进行实验,还有看 jquery.idcode.js 里的内容,比较精短,还是能看懂它是怎么实现的
引自 --- sam_yy_cn -
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询